From dfd9af4d844bcabbd3ef28cbf03715e48755b70c Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Tue, 19 Feb 2019 20:51:48 +0100 Subject: [PATCH] Added ASM function signature comment. Closes #82. --- .../kickc/passes/Pass4CodeGeneration.java | 38 +++++++++ .../dk/camelot64/kickc/test/TestPrograms.java | 8 +- src/test/ref/assignment-compound.asm | 1 + src/test/ref/assignment-compound.log | 3 + src/test/ref/bitmap-plotter.asm | 1 + src/test/ref/bitmap-plotter.log | 3 + src/test/ref/bool-function.asm | 1 + src/test/ref/bool-function.log | 3 + src/test/ref/c64dtv-8bppcharstretch.asm | 1 + src/test/ref/c64dtv-8bppcharstretch.log | 3 + src/test/ref/c64dtv-8bppchunkystretch.asm | 1 + src/test/ref/c64dtv-8bppchunkystretch.log | 3 + src/test/ref/c64dtv-gfxexplorer.asm | 19 +++++ src/test/ref/c64dtv-gfxexplorer.log | 81 ++++++++++++++++--- src/test/ref/c64dtv-gfxmodes.asm | 10 +++ src/test/ref/c64dtv-gfxmodes.log | 30 +++++++ src/test/ref/callconstparam.asm | 1 + src/test/ref/callconstparam.log | 3 + src/test/ref/complex/tetris/tetris.asm | 10 +++ src/test/ref/complex/tetris/tetris.log | 30 +++++++ src/test/ref/const-identification.asm | 1 + src/test/ref/const-identification.log | 3 + src/test/ref/const-param.asm | 1 + src/test/ref/const-param.log | 3 + src/test/ref/constants.asm | 3 + src/test/ref/constants.log | 9 +++ src/test/ref/examples/3d/3d.asm | 6 ++ src/test/ref/examples/3d/3d.log | 22 ++++- src/test/ref/examples/3d/perspective.asm | 4 + src/test/ref/examples/3d/perspective.log | 12 +++ .../examples/bresenham/bitmap-bresenham.asm | 6 ++ .../examples/bresenham/bitmap-bresenham.log | 18 +++++ .../ref/examples/chargen/chargen-analysis.asm | 6 ++ .../ref/examples/chargen/chargen-analysis.log | 18 +++++ .../examples/fastmultiply/fastmultiply8.asm | 4 + .../examples/fastmultiply/fastmultiply8.log | 12 +++ .../ref/examples/helloworld/helloworld.asm | 1 + .../ref/examples/helloworld/helloworld.log | 3 + src/test/ref/examples/rotate/rotate.asm | 2 + src/test/ref/examples/rotate/rotate.log | 6 ++ .../ref/examples/scrolllogo/scrolllogo.asm | 8 ++ .../ref/examples/scrolllogo/scrolllogo.log | 24 ++++++ src/test/ref/examples/showlogo/showlogo.asm | 1 + src/test/ref/examples/showlogo/showlogo.log | 3 + .../ref/examples/sinplotter/sine-plotter.asm | 8 ++ .../ref/examples/sinplotter/sine-plotter.log | 24 ++++++ .../ref/examples/sinsprites/sinus-sprites.asm | 8 ++ .../ref/examples/sinsprites/sinus-sprites.log | 24 ++++++ src/test/ref/fillscreen.asm | 1 + src/test/ref/fillscreen.log | 3 + src/test/ref/fragment-synth.asm | 1 + src/test/ref/fragment-synth.log | 3 + src/test/ref/helloworld2.asm | 1 + src/test/ref/helloworld2.log | 3 + src/test/ref/incrementinarray.asm | 1 + src/test/ref/incrementinarray.log | 3 + src/test/ref/inline-string-2.asm | 2 + src/test/ref/inline-string-2.log | 6 ++ src/test/ref/inline-string.asm | 1 + src/test/ref/inline-string.log | 3 + src/test/ref/keyboard-glitch.asm | 2 + src/test/ref/keyboard-glitch.log | 6 ++ src/test/ref/line-anim.asm | 5 ++ src/test/ref/line-anim.log | 19 ++++- src/test/ref/linegen.asm | 6 ++ src/test/ref/linegen.log | 18 +++++ src/test/ref/loopnest3.asm | 2 + src/test/ref/loopnest3.log | 6 ++ src/test/ref/min-fmul-16.asm | 4 + src/test/ref/min-fmul-16.log | 12 +++ src/test/ref/norom-charset.asm | 1 + src/test/ref/norom-charset.log | 3 + src/test/ref/overlap-allocation-2.asm | 2 + src/test/ref/overlap-allocation-2.log | 6 ++ src/test/ref/overlap-allocation.asm | 1 + src/test/ref/overlap-allocation.log | 3 + src/test/ref/printmsg.asm | 1 + src/test/ref/printmsg.log | 3 + src/test/ref/roll-sprite-msb.asm | 1 + src/test/ref/roll-sprite-msb.log | 3 + src/test/ref/scan-desire-problem.asm | 3 + src/test/ref/scan-desire-problem.log | 9 +++ src/test/ref/sinus-basic.asm | 7 ++ src/test/ref/sinus-basic.log | 21 +++++ src/test/ref/sinusgen16.asm | 9 +++ src/test/ref/sinusgen16.log | 27 +++++++ src/test/ref/sinusgen16b.asm | 11 +++ src/test/ref/sinusgen16b.log | 33 ++++++++ src/test/ref/sinusgen8.asm | 8 ++ src/test/ref/sinusgen8.log | 24 ++++++ src/test/ref/sinusgen8b.asm | 12 +++ src/test/ref/sinusgen8b.log | 36 +++++++++ src/test/ref/sinusgenscale8.asm | 12 +++ src/test/ref/sinusgenscale8.log | 40 ++++++++- src/test/ref/summin.asm | 1 + src/test/ref/summin.log | 3 + src/test/ref/test-address-of-param.asm | 1 + src/test/ref/test-address-of-param.log | 3 + src/test/ref/test-comments-block.asm | 1 + src/test/ref/test-comments-block.log | 3 + src/test/ref/test-comments-single.asm | 1 + src/test/ref/test-comments-single.log | 3 + src/test/ref/test-comparisons.asm | 4 + src/test/ref/test-comparisons.log | 12 +++ src/test/ref/test-division.asm | 13 +++ src/test/ref/test-division.log | 39 +++++++++ src/test/ref/test-keyboard.asm | 3 + src/test/ref/test-keyboard.log | 9 +++ src/test/ref/test-lowhigh.asm | 4 + src/test/ref/test-lowhigh.log | 12 +++ src/test/ref/test-multiply-16bit.asm | 15 ++++ src/test/ref/test-multiply-16bit.log | 47 ++++++++++- src/test/ref/test-multiply-8bit.asm | 17 ++++ src/test/ref/test-multiply-8bit.log | 51 ++++++++++++ src/test/ref/var-register.asm | 1 + src/test/ref/var-register.log | 3 + src/test/ref/voronoi.asm | 1 + src/test/ref/voronoi.log | 3 + src/test/ref/zpparammin.asm | 2 + src/test/ref/zpparammin.log | 6 ++ src/test/script/update-ref.sh | 7 +- 121 files changed, 1115 insertions(+), 24 deletions(-) diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java index 689528017..ddc0e5f22 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java @@ -71,6 +71,8 @@ public class Pass4CodeGeneration { if(block.isProcedureEntry(program)) { Procedure procedure = block.getProcedure(program); generateComments(asm, procedure.getComments()); + // Generate parameter information + generateSignatureComments(asm, procedure); } // Start the new scope asm.addScopeBegin(block.getLabel().getFullName().replace('@', 'b').replace(':', '_')); @@ -142,6 +144,42 @@ public class Pass4CodeGeneration { program.setAsm(asm); } + /** + * Generate a comment that describes the procedure signature and parameter transfer + * @param asm The assembler program being generated + * @param procedure The procedure + */ + private void generateSignatureComments(AsmProgram asm, Procedure procedure) { + StringBuilder signature = new StringBuilder(); + signature.append(" ").append(procedure.getLocalName()).append("("); + int i = 0; + for(Variable parameter : procedure.getParameters()) { + List versions = new ArrayList<>(procedure.getVersions((VariableUnversioned) parameter)); + if(versions.size() > 0) { + VariableVersion param = versions.get(0); + Registers.Register allocation = param.getAllocation(); + if(i++ > 0) signature.append(", "); + signature.append(param.getType().getTypeName()).append(" "); + if(allocation instanceof Registers.RegisterZp) { + Registers.RegisterZp registerZp = (Registers.RegisterZp) allocation; + signature.append("zeropage(").append(AsmFormat.getAsmNumber(registerZp.getZp())).append(")"); + } else if(allocation instanceof Registers.RegisterAByte) { + signature.append("register(A)"); + } else if(allocation instanceof Registers.RegisterXByte) { + signature.append("register(X)"); + } else if(allocation instanceof Registers.RegisterYByte) { + signature.append("register(Y)"); + } + signature.append(" "); + signature.append(parameter.getLocalName()); + } + } + signature.append(")"); + if(i>0) { + asm.addComment(signature.toString(), false); + } + } + /** * Add constant declarations for all scope constants * diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index b7f5958fc..f67ba95a3 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -99,10 +99,10 @@ public class TestPrograms { compileAndCompare("runtime-unused-procedure"); } - //@Test - //public void testRobozzle64() throws IOException, URISyntaxException { - // compileAndCompare("complex/robozzle64/robozzle64"); - //} +// @Test +// public void testRobozzle64() throws IOException, URISyntaxException { +// compileAndCompare("complex/robozzle64/robozzle64"); +// } @Test public void testTetrisSprites() throws IOException, URISyntaxException { diff --git a/src/test/ref/assignment-compound.asm b/src/test/ref/assignment-compound.asm index e4ce0d69c..2dc7a0d86 100644 --- a/src/test/ref/assignment-compound.asm +++ b/src/test/ref/assignment-compound.asm @@ -54,6 +54,7 @@ main: { jsr test rts } +// test(byte register(X) i, byte zeropage(2) a) test: { .label a = 2 lda a diff --git a/src/test/ref/assignment-compound.log b/src/test/ref/assignment-compound.log index d40c5e0ec..7e3bd5092 100644 --- a/src/test/ref/assignment-compound.log +++ b/src/test/ref/assignment-compound.log @@ -949,6 +949,7 @@ main: { rts } //SEG77 test +// test(byte zeropage(3) i, byte zeropage(2) a) test: { .label a = 2 .label i = 3 @@ -1200,6 +1201,7 @@ main: { rts } //SEG77 test +// test(byte register(X) i, byte zeropage(2) a) test: { .label a = 2 //SEG78 [28] *((const byte*) screen1#0 + (byte) test::i#11) ← (byte) test::a#11 -- pbuc1_derefidx_vbuxx=vbuz1 @@ -1475,6 +1477,7 @@ main: { rts } //SEG77 test +// test(byte register(X) i, byte zeropage(2) a) test: { .label a = 2 //SEG78 [28] *((const byte*) screen1#0 + (byte) test::i#11) ← (byte) test::a#11 -- pbuc1_derefidx_vbuxx=vbuz1 diff --git a/src/test/ref/bitmap-plotter.asm b/src/test/ref/bitmap-plotter.asm index 53f3de4da..8daed0b6f 100644 --- a/src/test/ref/bitmap-plotter.asm +++ b/src/test/ref/bitmap-plotter.asm @@ -44,6 +44,7 @@ plots: { bcc b1 rts } +// plot(byte zeropage(4) x, byte zeropage(5) y) plot: { .label x = 4 .label y = 5 diff --git a/src/test/ref/bitmap-plotter.log b/src/test/ref/bitmap-plotter.log index 1052da81d..86c41ffe1 100644 --- a/src/test/ref/bitmap-plotter.log +++ b/src/test/ref/bitmap-plotter.log @@ -1154,6 +1154,7 @@ plots: { rts } //SEG42 plot +// plot(byte zeropage($c) x, byte zeropage($d) y) plot: { .label _1 = $11 .label _3 = $18 @@ -1714,6 +1715,7 @@ plots: { rts } //SEG42 plot +// plot(byte zeropage(4) x, byte zeropage(5) y) plot: { .label x = 4 .label y = 5 @@ -2295,6 +2297,7 @@ plots: { rts } //SEG42 plot +// plot(byte zeropage(4) x, byte zeropage(5) y) plot: { .label x = 4 .label y = 5 diff --git a/src/test/ref/bool-function.asm b/src/test/ref/bool-function.asm index 5bcec4f28..248d23d9b 100644 --- a/src/test/ref/bool-function.asm +++ b/src/test/ref/bool-function.asm @@ -31,6 +31,7 @@ main: { } // Determine whether to set a char to '*. // Returns true if i&8!=0 or b=true +// isSet(byte register(X) i, bool zeropage(2) b) isSet: { .label b = 2 txa diff --git a/src/test/ref/bool-function.log b/src/test/ref/bool-function.log index 9e6811d72..97ee706aa 100644 --- a/src/test/ref/bool-function.log +++ b/src/test/ref/bool-function.log @@ -358,6 +358,7 @@ main: { //SEG33 isSet // Determine whether to set a char to '*. // Returns true if i&8!=0 or b=true +// isSet(byte zeropage(5) i, bool zeropage(4) b) isSet: { .label _0 = 8 .label _1 = 9 @@ -513,6 +514,7 @@ main: { //SEG33 isSet // Determine whether to set a char to '*. // Returns true if i&8!=0 or b=true +// isSet(byte register(X) i, bool zeropage(2) b) isSet: { .label b = 2 //SEG34 [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuaa=vbuxx_band_vbuc1 @@ -675,6 +677,7 @@ main: { //SEG33 isSet // Determine whether to set a char to '*. // Returns true if i&8!=0 or b=true +// isSet(byte register(X) i, bool zeropage(2) b) isSet: { .label b = 2 //SEG34 [18] (byte~) isSet::$0 ← (byte) isSet::i#0 & (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuaa=vbuxx_band_vbuc1 diff --git a/src/test/ref/c64dtv-8bppcharstretch.asm b/src/test/ref/c64dtv-8bppcharstretch.asm index d5ebd3f3c..e26c73472 100644 --- a/src/test/ref/c64dtv-8bppcharstretch.asm +++ b/src/test/ref/c64dtv-8bppcharstretch.asm @@ -291,6 +291,7 @@ gfx_init_plane_charset8: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff diff --git a/src/test/ref/c64dtv-8bppcharstretch.log b/src/test/ref/c64dtv-8bppcharstretch.log index 40cee34c6..0f69668be 100644 --- a/src/test/ref/c64dtv-8bppcharstretch.log +++ b/src/test/ref/c64dtv-8bppcharstretch.log @@ -2434,6 +2434,7 @@ gfx_init_plane_charset8: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte zeropage($d) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff @@ -3193,6 +3194,7 @@ gfx_init_plane_charset8: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff @@ -4144,6 +4146,7 @@ gfx_init_plane_charset8: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff diff --git a/src/test/ref/c64dtv-8bppchunkystretch.asm b/src/test/ref/c64dtv-8bppchunkystretch.asm index 88bb54ab7..7f8f6d88f 100644 --- a/src/test/ref/c64dtv-8bppchunkystretch.asm +++ b/src/test/ref/c64dtv-8bppchunkystretch.asm @@ -258,6 +258,7 @@ gfx_init_chunky: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff diff --git a/src/test/ref/c64dtv-8bppchunkystretch.log b/src/test/ref/c64dtv-8bppchunkystretch.log index 17aa4ad70..4bfd5d29f 100644 --- a/src/test/ref/c64dtv-8bppchunkystretch.log +++ b/src/test/ref/c64dtv-8bppchunkystretch.log @@ -2005,6 +2005,7 @@ gfx_init_chunky: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte zeropage(9) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff @@ -2535,6 +2536,7 @@ gfx_init_chunky: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff @@ -3264,6 +3266,7 @@ gfx_init_chunky: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff diff --git a/src/test/ref/c64dtv-gfxexplorer.asm b/src/test/ref/c64dtv-gfxexplorer.asm index 49a2ec599..a3d73368a 100644 --- a/src/test/ref/c64dtv-gfxexplorer.asm +++ b/src/test/ref/c64dtv-gfxexplorer.asm @@ -654,6 +654,7 @@ keyboard_event_scan: { } // Determine if a specific key is currently pressed based on the last keyboard_event_scan() // Returns 0 is not pressed and non-0 if pressed +// keyboard_event_pressed(byte zeropage(7) keycode) keyboard_event_pressed: { .label row_bits = 8 .label keycode = 7 @@ -676,6 +677,7 @@ keyboard_event_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(A) rowid) keyboard_matrix_read: { tay lda keyboard_matrix_row_bitmask,y @@ -685,6 +687,7 @@ keyboard_matrix_read: { rts } // Get the VIC screen address from the screen index +// get_vic_screen(byte register(A) idx) get_vic_screen: { .label return = 3 cmp #0 @@ -729,6 +732,7 @@ get_vic_screen: { rts } // Get the VIC charset/bitmap address from the index +// get_vic_charset(byte register(A) idx) get_vic_charset: { .label return = 3 cmp #0 @@ -749,6 +753,7 @@ get_vic_charset: { rts } // Get plane address from a plane index (from the form) +// get_plane(byte register(A) idx) get_plane: { .label return = $a cmp #0 @@ -1042,6 +1047,7 @@ form_mode: { } // Render form preset name in the form // idx is the ID of the preset +// render_preset_name(byte register(A) idx) render_preset_name: { .label name = 3 cmp #0 @@ -1153,6 +1159,7 @@ render_preset_name: { name_11: .text "Standard Charset @" } // Print a string at a specific screen position +// print_str_at(byte* zeropage(3) str, byte* zeropage(5) at) print_str_at: { .label at = 5 .label str = 3 @@ -1202,6 +1209,7 @@ form_render_values: { } // Get the screen address of a form field // field_idx is the index of the field to get the screen address for +// form_field_ptr(byte zeropage(2) field_idx) form_field_ptr: { .label return = 3 .label field_idx = 2 @@ -1225,6 +1233,7 @@ form_field_ptr: { } // Apply a form value preset to the form values // idx is the ID of the preset +// apply_preset(byte register(A) idx) apply_preset: { .label preset = 3 cmp #0 @@ -1455,6 +1464,7 @@ form_set_screen: { } // Print a number of zero-terminated strings, each followed by a newline. // The sequence of lines is terminated by another zero. +// print_str_lines(byte* zeropage(3) str) print_str_lines: { .label str = 3 lda print_set_screen.screen @@ -1544,6 +1554,7 @@ print_cls: { rts } // Set the screen to print on. Also resets current line/char cursor. +// print_set_screen(byte* zeropage($10) screen) print_set_screen: { .label screen = $10 rts @@ -1583,6 +1594,7 @@ gfx_init_plane_full: { rts } // Initialize 320*200 1bpp pixel ($2000) plane with identical bytes +// gfx_init_plane_fill(dword zeropage($a) plane_addr, byte zeropage(2) fill) gfx_init_plane_fill: { .label _0 = $13 .label _1 = 3 @@ -1661,6 +1673,7 @@ gfx_init_plane_fill: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff @@ -1986,6 +1999,7 @@ gfx_init_vic_bitmap: { lines_y: .byte 0, 0, $c7, $c7, 0, 0, $64, $c7, $64, 0 } // Draw a line on the bitmap +// bitmap_line(byte zeropage(9) x0, byte zeropage($12) x1, byte zeropage($f) y0, byte register(Y) y1) bitmap_line: { .label xd = 8 .label yd = 7 @@ -2089,6 +2103,7 @@ bitmap_line: { jsr bitmap_line_xdyi jmp breturn } +// bitmap_line_xdyi(byte zeropage($e) x, byte zeropage($f) y, byte zeropage(9) x1, byte zeropage(8) xd, byte zeropage(7) yd) bitmap_line_xdyi: { .label x = $e .label y = $f @@ -2123,6 +2138,7 @@ bitmap_line_xdyi: { bne b1 rts } +// bitmap_plot(byte register(X) x, byte register(Y) y) bitmap_plot: { .label _0 = 3 .label plotter_x = 3 @@ -2148,6 +2164,7 @@ bitmap_plot: { sta (_0),y rts } +// bitmap_line_ydxi(byte zeropage($e) y, byte register(X) x, byte zeropage($f) y1, byte zeropage(7) yd, byte zeropage(8) xd) bitmap_line_ydxi: { .label y = $e .label y1 = $f @@ -2181,6 +2198,7 @@ bitmap_line_ydxi: { bne b1 rts } +// bitmap_line_xdyd(byte zeropage($e) x, byte zeropage($f) y, byte zeropage($12) x1, byte zeropage(8) xd, byte zeropage(7) yd) bitmap_line_xdyd: { .label x = $e .label y = $f @@ -2215,6 +2233,7 @@ bitmap_line_xdyd: { bne b1 rts } +// bitmap_line_ydxd(byte zeropage($e) y, byte register(X) x, byte zeropage($f) y1, byte zeropage(7) yd, byte zeropage(8) xd) bitmap_line_ydxd: { .label y = $e .label y1 = $f diff --git a/src/test/ref/c64dtv-gfxexplorer.log b/src/test/ref/c64dtv-gfxexplorer.log index d7a0f760d..1ca172df3 100644 --- a/src/test/ref/c64dtv-gfxexplorer.log +++ b/src/test/ref/c64dtv-gfxexplorer.log @@ -15174,6 +15174,7 @@ keyboard_event_scan: { //SEG375 keyboard_event_pressed // Determine if a specific key is currently pressed based on the last keyboard_event_scan() // Returns 0 is not pressed and non-0 if pressed +// keyboard_event_pressed(byte zeropage($13) keycode) keyboard_event_pressed: { .label _0 = $102 .label _1 = $104 @@ -15215,6 +15216,7 @@ keyboard_event_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte zeropage($f3) rowid) keyboard_matrix_read: { .label return = $106 .label rowid = $f3 @@ -15235,6 +15237,7 @@ keyboard_matrix_read: { } //SEG387 get_vic_screen // Get the VIC screen address from the screen index +// get_vic_screen(byte zeropage($14) idx) get_vic_screen: { .label return = $15 .label idx = $14 @@ -15326,6 +15329,7 @@ get_vic_screen: { } //SEG411 get_vic_charset // Get the VIC charset/bitmap address from the index +// get_vic_charset(byte zeropage($dd) idx) get_vic_charset: { .label return = $17 .label idx = $dd @@ -15371,6 +15375,7 @@ get_vic_charset: { } //SEG423 get_plane // Get plane address from a plane index (from the form) +// get_plane(byte zeropage($19) idx) get_plane: { .label return = $1a .label idx = $19 @@ -15924,6 +15929,7 @@ form_mode: { //SEG581 render_preset_name // Render form preset name in the form // idx is the ID of the preset +// render_preset_name(byte zeropage($22) idx) render_preset_name: { .label idx = $22 .label name = $23 @@ -16133,6 +16139,7 @@ render_preset_name: { } //SEG635 print_str_at // Print a string at a specific screen position +// print_str_at(byte* zeropage($25) str, byte* zeropage($27) at) print_str_at: { .label at = $27 .label str = $25 @@ -16240,6 +16247,7 @@ form_render_values: { //SEG668 form_field_ptr // Get the screen address of a form field // field_idx is the index of the field to get the screen address for +// form_field_ptr(byte zeropage($2a) field_idx) form_field_ptr: { .label y = $10e .label x = $111 @@ -16279,6 +16287,7 @@ form_field_ptr: { //SEG675 apply_preset // Apply a form value preset to the form values // idx is the ID of the preset +// apply_preset(byte zeropage($109) idx) apply_preset: { .label i = $2d .label idx = $109 @@ -16842,6 +16851,7 @@ form_set_screen: { //SEG842 print_str_lines // Print a number of zero-terminated strings, each followed by a newline. // The sequence of lines is terminated by another zero. +// print_str_lines(byte* zeropage($32) str) print_str_lines: { .label ch = $121 .label str = $32 @@ -17011,6 +17021,7 @@ print_cls: { } //SEG890 print_set_screen // Set the screen to print on. Also resets current line/char cursor. +// print_set_screen(byte* zeropage($36) screen) print_set_screen: { .label screen = $36 jmp breturn @@ -17183,6 +17194,7 @@ gfx_init_plane_full: { } //SEG960 gfx_init_plane_fill // Initialize 320*200 1bpp pixel ($2000) plane with identical bytes +// gfx_init_plane_fill(dword zeropage($3a) plane_addr, byte zeropage($3e) fill) gfx_init_plane_fill: { .label _0 = $124 .label _1 = $128 @@ -17335,6 +17347,7 @@ gfx_init_plane_fill: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte zeropage($43) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff @@ -18109,6 +18122,7 @@ gfx_init_vic_bitmap: { } //SEG1271 bitmap_line // Draw a line on the bitmap +// bitmap_line(byte zeropage($139) x0, byte zeropage($13a) x1, byte zeropage($13b) y0, byte zeropage($13c) y1) bitmap_line: { .label xd = $140 .label xd_1 = $13d @@ -18419,6 +18433,7 @@ bitmap_line: { jmp breturn } //SEG1397 bitmap_line_xdyi +// bitmap_line_xdyi(byte zeropage($64) x, byte zeropage($65) y, byte zeropage($63) x1, byte zeropage($62) xd, byte zeropage($61) yd) bitmap_line_xdyi: { .label _6 = $143 .label x = $64 @@ -18499,6 +18514,7 @@ bitmap_line_xdyi: { rts } //SEG1425 bitmap_plot +// bitmap_plot(byte zeropage($67) x, byte zeropage($68) y) bitmap_plot: { .label _0 = $148 .label _1 = $14a @@ -18543,6 +18559,7 @@ bitmap_plot: { rts } //SEG1433 bitmap_line_ydxi +// bitmap_line_ydxi(byte zeropage($6d) y, byte zeropage($6c) x, byte zeropage($6b) y1, byte zeropage($6a) yd, byte zeropage($69) xd) bitmap_line_ydxi: { .label _6 = $14b .label y = $6d @@ -18623,6 +18640,7 @@ bitmap_line_ydxi: { rts } //SEG1461 bitmap_line_xdyd +// bitmap_line_xdyd(byte zeropage($72) x, byte zeropage($73) y, byte zeropage($71) x1, byte zeropage($70) xd, byte zeropage($6f) yd) bitmap_line_xdyd: { .label _6 = $14c .label x = $72 @@ -18703,6 +18721,7 @@ bitmap_line_xdyd: { rts } //SEG1489 bitmap_line_ydxd +// bitmap_line_ydxd(byte zeropage($79) y, byte zeropage($78) x, byte zeropage($77) y1, byte zeropage($76) yd, byte zeropage($75) xd) bitmap_line_ydxd: { .label _6 = $14d .label y = $79 @@ -22245,6 +22264,7 @@ keyboard_event_scan: { //SEG375 keyboard_event_pressed // Determine if a specific key is currently pressed based on the last keyboard_event_scan() // Returns 0 is not pressed and non-0 if pressed +// keyboard_event_pressed(byte zeropage(7) keycode) keyboard_event_pressed: { .label row_bits = 8 .label keycode = 7 @@ -22276,6 +22296,7 @@ keyboard_event_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(A) rowid) keyboard_matrix_read: { //SEG383 [219] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) -- _deref_pbuc1=pbuc2_derefidx_vbuaa tay @@ -22292,6 +22313,7 @@ keyboard_matrix_read: { } //SEG387 get_vic_screen // Get the VIC screen address from the screen index +// get_vic_screen(byte register(A) idx) get_vic_screen: { .label return = 3 //SEG388 [223] if((byte) get_vic_screen::idx#2==(byte/signed byte/word/signed word/dword/signed dword) 0) goto get_vic_screen::@return -- vbuaa_eq_0_then_la1 @@ -22375,6 +22397,7 @@ get_vic_screen: { } //SEG411 get_vic_charset // Get the VIC charset/bitmap address from the index +// get_vic_charset(byte register(A) idx) get_vic_charset: { .label return = 3 //SEG412 [231] if((byte) get_vic_charset::idx#0==(byte/signed byte/word/signed word/dword/signed dword) 0) goto get_vic_charset::@return -- vbuaa_eq_0_then_la1 @@ -22416,6 +22439,7 @@ get_vic_charset: { } //SEG423 get_plane // Get plane address from a plane index (from the form) +// get_plane(byte register(A) idx) get_plane: { .label return = $a //SEG424 [237] if((byte) get_plane::idx#10==(byte/signed byte/word/signed word/dword/signed dword) 0) goto get_plane::@return -- vbuaa_eq_0_then_la1 @@ -22940,6 +22964,7 @@ form_mode: { //SEG581 render_preset_name // Render form preset name in the form // idx is the ID of the preset +// render_preset_name(byte register(A) idx) render_preset_name: { .label name = 3 //SEG582 [307] if((byte) render_preset_name::idx#10==(byte/signed byte/word/signed word/dword/signed dword) 0) goto render_preset_name::@22 -- vbuaa_eq_0_then_la1 @@ -23133,6 +23158,7 @@ render_preset_name: { } //SEG635 print_str_at // Print a string at a specific screen position +// print_str_at(byte* zeropage(3) str, byte* zeropage(5) at) print_str_at: { .label at = 5 .label str = 3 @@ -23230,6 +23256,7 @@ form_render_values: { //SEG668 form_field_ptr // Get the screen address of a form field // field_idx is the index of the field to get the screen address for +// form_field_ptr(byte zeropage(2) field_idx) form_field_ptr: { .label return = 3 .label field_idx = 2 @@ -23262,6 +23289,7 @@ form_field_ptr: { //SEG675 apply_preset // Apply a form value preset to the form values // idx is the ID of the preset +// apply_preset(byte register(A) idx) apply_preset: { .label preset = 3 //SEG676 [346] if((byte) apply_preset::idx#0==(byte/signed byte/word/signed word/dword/signed dword) 0) goto apply_preset::@22 -- vbuaa_eq_0_then_la1 @@ -23752,6 +23780,7 @@ form_set_screen: { //SEG842 print_str_lines // Print a number of zero-terminated strings, each followed by a newline. // The sequence of lines is terminated by another zero. +// print_str_lines(byte* zeropage(3) str) print_str_lines: { .label str = 3 //SEG843 [420] (byte*~) print_char_cursor#77 ← (byte*) print_set_screen::screen#2 -- pbuz1=pbuz2 @@ -23916,6 +23945,7 @@ print_cls: { } //SEG890 print_set_screen // Set the screen to print on. Also resets current line/char cursor. +// print_set_screen(byte* zeropage($10) screen) print_set_screen: { .label screen = $10 jmp breturn @@ -24088,6 +24118,7 @@ gfx_init_plane_full: { } //SEG960 gfx_init_plane_fill // Initialize 320*200 1bpp pixel ($2000) plane with identical bytes +// gfx_init_plane_fill(dword zeropage($a) plane_addr, byte zeropage(2) fill) gfx_init_plane_fill: { .label _0 = $13 .label _1 = 3 @@ -24227,6 +24258,7 @@ gfx_init_plane_fill: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff @@ -24955,6 +24987,7 @@ gfx_init_vic_bitmap: { } //SEG1271 bitmap_line // Draw a line on the bitmap +// bitmap_line(byte zeropage(9) x0, byte zeropage($12) x1, byte zeropage($f) y0, byte register(Y) y1) bitmap_line: { .label xd = 8 .label yd = 7 @@ -25212,6 +25245,7 @@ bitmap_line: { jmp breturn } //SEG1397 bitmap_line_xdyi +// bitmap_line_xdyi(byte zeropage($e) x, byte zeropage($f) y, byte zeropage(9) x1, byte zeropage(8) xd, byte zeropage(7) yd) bitmap_line_xdyi: { .label x = $e .label y = $f @@ -25287,6 +25321,7 @@ bitmap_line_xdyi: { rts } //SEG1425 bitmap_plot +// bitmap_plot(byte register(X) x, byte register(Y) y) bitmap_plot: { .label _0 = 3 .label plotter_x = 3 @@ -25323,6 +25358,7 @@ bitmap_plot: { rts } //SEG1433 bitmap_line_ydxi +// bitmap_line_ydxi(byte zeropage($e) y, byte register(X) x, byte zeropage($f) y1, byte zeropage(7) yd, byte zeropage(8) xd) bitmap_line_ydxi: { .label y = $e .label y1 = $f @@ -25397,6 +25433,7 @@ bitmap_line_ydxi: { rts } //SEG1461 bitmap_line_xdyd +// bitmap_line_xdyd(byte zeropage($e) x, byte zeropage($f) y, byte zeropage($12) x1, byte zeropage(8) xd, byte zeropage(7) yd) bitmap_line_xdyd: { .label x = $e .label y = $f @@ -25472,6 +25509,7 @@ bitmap_line_xdyd: { rts } //SEG1489 bitmap_line_ydxd +// bitmap_line_ydxd(byte zeropage($e) y, byte register(X) x, byte zeropage($f) y1, byte zeropage(7) yd, byte zeropage(8) xd) bitmap_line_ydxd: { .label y = $e .label y1 = $f @@ -27334,18 +27372,18 @@ Removing instruction b37: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b7 Succesful ASM optimization Pass5UnreachableCodeElimination -Fixing long branch [762] beq b5 to bne -Fixing long branch [766] beq b6 to bne -Fixing long branch [770] beq b7 to bne -Fixing long branch [774] beq b8 to bne -Fixing long branch [760] beq b4 to bne -Fixing long branch [780] beq b9 to bne -Fixing long branch [784] beq b10 to bne -Fixing long branch [788] beq b11 to bne -Fixing long branch [792] beq b12 to bne -Fixing long branch [758] beq b3 to bne -Fixing long branch [798] beq b13 to bne -Fixing long branch [1346] bmi b2 to bpl +Fixing long branch [767] beq b5 to bne +Fixing long branch [771] beq b6 to bne +Fixing long branch [775] beq b7 to bne +Fixing long branch [779] beq b8 to bne +Fixing long branch [765] beq b4 to bne +Fixing long branch [785] beq b9 to bne +Fixing long branch [789] beq b10 to bne +Fixing long branch [793] beq b11 to bne +Fixing long branch [797] beq b12 to bne +Fixing long branch [763] beq b3 to bne +Fixing long branch [803] beq b13 to bne +Fixing long branch [1355] bmi b2 to bpl FINAL SYMBOL TABLE (label) @68 @@ -30086,6 +30124,7 @@ keyboard_event_scan: { //SEG375 keyboard_event_pressed // Determine if a specific key is currently pressed based on the last keyboard_event_scan() // Returns 0 is not pressed and non-0 if pressed +// keyboard_event_pressed(byte zeropage(7) keycode) keyboard_event_pressed: { .label row_bits = 8 .label keycode = 7 @@ -30115,6 +30154,7 @@ keyboard_event_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(A) rowid) keyboard_matrix_read: { //SEG383 [219] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) -- _deref_pbuc1=pbuc2_derefidx_vbuaa tay @@ -30129,6 +30169,7 @@ keyboard_matrix_read: { } //SEG387 get_vic_screen // Get the VIC screen address from the screen index +// get_vic_screen(byte register(A) idx) get_vic_screen: { .label return = 3 //SEG388 [223] if((byte) get_vic_screen::idx#2==(byte/signed byte/word/signed word/dword/signed dword) 0) goto get_vic_screen::@return -- vbuaa_eq_0_then_la1 @@ -30197,6 +30238,7 @@ get_vic_screen: { } //SEG411 get_vic_charset // Get the VIC charset/bitmap address from the index +// get_vic_charset(byte register(A) idx) get_vic_charset: { .label return = 3 //SEG412 [231] if((byte) get_vic_charset::idx#0==(byte/signed byte/word/signed word/dword/signed dword) 0) goto get_vic_charset::@return -- vbuaa_eq_0_then_la1 @@ -30229,6 +30271,7 @@ get_vic_charset: { } //SEG423 get_plane // Get plane address from a plane index (from the form) +// get_plane(byte register(A) idx) get_plane: { .label return = $a //SEG424 [237] if((byte) get_plane::idx#10==(byte/signed byte/word/signed word/dword/signed dword) 0) goto get_plane::@return -- vbuaa_eq_0_then_la1 @@ -30680,6 +30723,7 @@ form_mode: { //SEG581 render_preset_name // Render form preset name in the form // idx is the ID of the preset +// render_preset_name(byte register(A) idx) render_preset_name: { .label name = 3 //SEG582 [307] if((byte) render_preset_name::idx#10==(byte/signed byte/word/signed word/dword/signed dword) 0) goto render_preset_name::@22 -- vbuaa_eq_0_then_la1 @@ -30845,6 +30889,7 @@ render_preset_name: { } //SEG635 print_str_at // Print a string at a specific screen position +// print_str_at(byte* zeropage(3) str, byte* zeropage(5) at) print_str_at: { .label at = 5 .label str = 3 @@ -30927,6 +30972,7 @@ form_render_values: { //SEG668 form_field_ptr // Get the screen address of a form field // field_idx is the index of the field to get the screen address for +// form_field_ptr(byte zeropage(2) field_idx) form_field_ptr: { .label return = 3 .label field_idx = 2 @@ -30957,6 +31003,7 @@ form_field_ptr: { //SEG675 apply_preset // Apply a form value preset to the form values // idx is the ID of the preset +// apply_preset(byte register(A) idx) apply_preset: { .label preset = 3 //SEG676 [346] if((byte) apply_preset::idx#0==(byte/signed byte/word/signed word/dword/signed dword) 0) goto apply_preset::@22 -- vbuaa_eq_0_then_la1 @@ -31354,6 +31401,7 @@ form_set_screen: { //SEG842 print_str_lines // Print a number of zero-terminated strings, each followed by a newline. // The sequence of lines is terminated by another zero. +// print_str_lines(byte* zeropage(3) str) print_str_lines: { .label str = 3 //SEG843 [420] (byte*~) print_char_cursor#77 ← (byte*) print_set_screen::screen#2 -- pbuz1=pbuz2 @@ -31491,6 +31539,7 @@ print_cls: { } //SEG890 print_set_screen // Set the screen to print on. Also resets current line/char cursor. +// print_set_screen(byte* zeropage($10) screen) print_set_screen: { .label screen = $10 //SEG891 print_set_screen::@return @@ -31600,6 +31649,7 @@ gfx_init_plane_full: { } //SEG960 gfx_init_plane_fill // Initialize 320*200 1bpp pixel ($2000) plane with identical bytes +// gfx_init_plane_fill(dword zeropage($a) plane_addr, byte zeropage(2) fill) gfx_init_plane_fill: { .label _0 = $13 .label _1 = 3 @@ -31720,6 +31770,7 @@ gfx_init_plane_fill: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff @@ -32314,6 +32365,7 @@ gfx_init_vic_bitmap: { } //SEG1271 bitmap_line // Draw a line on the bitmap +// bitmap_line(byte zeropage(9) x0, byte zeropage($12) x1, byte zeropage($f) y0, byte register(Y) y1) bitmap_line: { .label xd = 8 .label yd = 7 @@ -32543,6 +32595,7 @@ bitmap_line: { jmp breturn } //SEG1397 bitmap_line_xdyi +// bitmap_line_xdyi(byte zeropage($e) x, byte zeropage($f) y, byte zeropage(9) x1, byte zeropage(8) xd, byte zeropage(7) yd) bitmap_line_xdyi: { .label x = $e .label y = $f @@ -32605,6 +32658,7 @@ bitmap_line_xdyi: { rts } //SEG1425 bitmap_plot +// bitmap_plot(byte register(X) x, byte register(Y) y) bitmap_plot: { .label _0 = 3 .label plotter_x = 3 @@ -32638,6 +32692,7 @@ bitmap_plot: { rts } //SEG1433 bitmap_line_ydxi +// bitmap_line_ydxi(byte zeropage($e) y, byte register(X) x, byte zeropage($f) y1, byte zeropage(7) yd, byte zeropage(8) xd) bitmap_line_ydxi: { .label y = $e .label y1 = $f @@ -32699,6 +32754,7 @@ bitmap_line_ydxi: { rts } //SEG1461 bitmap_line_xdyd +// bitmap_line_xdyd(byte zeropage($e) x, byte zeropage($f) y, byte zeropage($12) x1, byte zeropage(8) xd, byte zeropage(7) yd) bitmap_line_xdyd: { .label x = $e .label y = $f @@ -32761,6 +32817,7 @@ bitmap_line_xdyd: { rts } //SEG1489 bitmap_line_ydxd +// bitmap_line_ydxd(byte zeropage($e) y, byte register(X) x, byte zeropage($f) y1, byte zeropage(7) yd, byte zeropage(8) xd) bitmap_line_ydxd: { .label y = $e .label y1 = $f diff --git a/src/test/ref/c64dtv-gfxmodes.asm b/src/test/ref/c64dtv-gfxmodes.asm index d2a073fec..c80652efa 100644 --- a/src/test/ref/c64dtv-gfxmodes.asm +++ b/src/test/ref/c64dtv-gfxmodes.asm @@ -452,6 +452,7 @@ mode_ctrl: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte register(Y) key) keyboard_key_pressed: { .label colidx = 7 tya @@ -472,6 +473,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(Y) rowid) keyboard_matrix_read: { lda keyboard_matrix_row_bitmask,y sta CIA1_PORT_A @@ -482,6 +484,7 @@ keyboard_matrix_read: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff @@ -1546,6 +1549,7 @@ mode_stdbitmap: { lines_y: .byte 0, 0, $c7, $c7, 0, 0, $64, $c7, $64, 0 } // Draw a line on the bitmap +// bitmap_line(byte zeropage(9) x0, byte zeropage($c) x1, byte zeropage($b) y0, byte register(Y) y1) bitmap_line: { .label xd = 8 .label yd = 7 @@ -1649,6 +1653,7 @@ bitmap_line: { jsr bitmap_line_xdyi jmp breturn } +// bitmap_line_xdyi(byte zeropage($a) x, byte zeropage($b) y, byte zeropage(9) x1, byte zeropage(8) xd, byte zeropage(7) yd) bitmap_line_xdyi: { .label x = $a .label y = $b @@ -1683,6 +1688,7 @@ bitmap_line_xdyi: { bne b1 rts } +// bitmap_plot(byte register(X) x, byte register(Y) y) bitmap_plot: { .label _0 = 2 .label plotter_x = 2 @@ -1708,6 +1714,7 @@ bitmap_plot: { sta (_0),y rts } +// bitmap_line_ydxi(byte zeropage($a) y, byte register(X) x, byte zeropage($b) y1, byte zeropage(7) yd, byte zeropage(8) xd) bitmap_line_ydxi: { .label y = $a .label y1 = $b @@ -1741,6 +1748,7 @@ bitmap_line_ydxi: { bne b1 rts } +// bitmap_line_xdyd(byte zeropage($a) x, byte zeropage($b) y, byte zeropage($c) x1, byte zeropage(8) xd, byte zeropage(7) yd) bitmap_line_xdyd: { .label x = $a .label y = $b @@ -1775,6 +1783,7 @@ bitmap_line_xdyd: { bne b1 rts } +// bitmap_line_ydxd(byte zeropage($a) y, byte register(X) x, byte zeropage($b) y1, byte zeropage(7) yd, byte zeropage(8) xd) bitmap_line_ydxd: { .label y = $a .label y1 = $b @@ -2223,6 +2232,7 @@ mode_stdchar: { } // Print a number of zero-terminated strings, each followed by a newline. // The sequence of lines is terminated by another zero. +// print_str_lines(byte* zeropage(2) str) print_str_lines: { .label str = 2 lda #print_str_lines::@1] @@ -27493,6 +27513,7 @@ mode_ctrl: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte register(Y) key) keyboard_key_pressed: { .label colidx = 7 //SEG392 [212] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#20 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuyy_band_vbuc1 @@ -27524,6 +27545,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(Y) rowid) keyboard_matrix_read: { //SEG403 [220] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) -- _deref_pbuc1=pbuc2_derefidx_vbuyy lda keyboard_matrix_row_bitmask,y @@ -27539,6 +27561,7 @@ keyboard_matrix_read: { // Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff) // This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff // The actual memory addressed will be $4000*cpuSegmentIdx +// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx) dtvSetCpuBankSegment1: { // Move CPU BANK 1 SEGMENT ($4000-$7fff) .label cpuBank = $ff @@ -29296,6 +29319,7 @@ mode_stdbitmap: { } //SEG1100 bitmap_line // Draw a line on the bitmap +// bitmap_line(byte zeropage(9) x0, byte zeropage($c) x1, byte zeropage($b) y0, byte register(Y) y1) bitmap_line: { .label xd = 8 .label yd = 7 @@ -29525,6 +29549,7 @@ bitmap_line: { jmp breturn } //SEG1226 bitmap_line_xdyi +// bitmap_line_xdyi(byte zeropage($a) x, byte zeropage($b) y, byte zeropage(9) x1, byte zeropage(8) xd, byte zeropage(7) yd) bitmap_line_xdyi: { .label x = $a .label y = $b @@ -29587,6 +29612,7 @@ bitmap_line_xdyi: { rts } //SEG1254 bitmap_plot +// bitmap_plot(byte register(X) x, byte register(Y) y) bitmap_plot: { .label _0 = 2 .label plotter_x = 2 @@ -29620,6 +29646,7 @@ bitmap_plot: { rts } //SEG1262 bitmap_line_ydxi +// bitmap_line_ydxi(byte zeropage($a) y, byte register(X) x, byte zeropage($b) y1, byte zeropage(7) yd, byte zeropage(8) xd) bitmap_line_ydxi: { .label y = $a .label y1 = $b @@ -29681,6 +29708,7 @@ bitmap_line_ydxi: { rts } //SEG1290 bitmap_line_xdyd +// bitmap_line_xdyd(byte zeropage($a) x, byte zeropage($b) y, byte zeropage($c) x1, byte zeropage(8) xd, byte zeropage(7) yd) bitmap_line_xdyd: { .label x = $a .label y = $b @@ -29743,6 +29771,7 @@ bitmap_line_xdyd: { rts } //SEG1318 bitmap_line_ydxd +// bitmap_line_ydxd(byte zeropage($a) y, byte register(X) x, byte zeropage($b) y1, byte zeropage(7) yd, byte zeropage(8) xd) bitmap_line_ydxd: { .label y = $a .label y1 = $b @@ -30480,6 +30509,7 @@ mode_stdchar: { //SEG1607 print_str_lines // Print a number of zero-terminated strings, each followed by a newline. // The sequence of lines is terminated by another zero. +// print_str_lines(byte* zeropage(2) str) print_str_lines: { .label str = 2 //SEG1608 [866] phi from print_str_lines to print_str_lines::@1 [phi:print_str_lines->print_str_lines::@1] diff --git a/src/test/ref/callconstparam.asm b/src/test/ref/callconstparam.asm index 3caf3ea50..fb6ba1091 100644 --- a/src/test/ref/callconstparam.asm +++ b/src/test/ref/callconstparam.asm @@ -20,6 +20,7 @@ main: { jsr line rts } +// line(byte zeropage(2) x1) line: { .label x1 = 2 b1: diff --git a/src/test/ref/callconstparam.log b/src/test/ref/callconstparam.log index c2251772e..abd9f3784 100644 --- a/src/test/ref/callconstparam.log +++ b/src/test/ref/callconstparam.log @@ -293,6 +293,7 @@ main: { rts } //SEG25 line +// line(byte zeropage(2) x1) line: { .label x = 3 .label x1 = 2 @@ -412,6 +413,7 @@ main: { rts } //SEG25 line +// line(byte zeropage(2) x1) line: { .label x1 = 2 //SEG26 [10] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1] @@ -551,6 +553,7 @@ main: { rts } //SEG25 line +// line(byte zeropage(2) x1) line: { .label x1 = 2 //SEG26 [10] phi from line line::@1 to line::@1 [phi:line/line::@1->line::@1] diff --git a/src/test/ref/complex/tetris/tetris.asm b/src/test/ref/complex/tetris/tetris.asm index 7554711cb..0075f3eac 100644 --- a/src/test/ref/complex/tetris/tetris.asm +++ b/src/test/ref/complex/tetris/tetris.asm @@ -352,6 +352,7 @@ render_score: { // - offset: offset on the screen // - bcd: The BCD-value to render // - only_low: if non-zero only renders the low digit +// render_bcd(byte* zeropage(5) screen, word zeropage(7) offset, byte register(X) bcd, byte register(Y) only_low) render_bcd: { .const ZERO_CHAR = $35 .label screen = 5 @@ -574,6 +575,7 @@ render_playfield: { // Perform any movement of the current piece // key_event is the next keyboard_event() og $ff if no keyboard event is pending // Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed) +// play_movement(byte zeropage($29) key_event) play_movement: { .label render = 9 .label return = 9 @@ -604,6 +606,7 @@ play_movement: { } // Rotate the current piece based on key-presses // Return non-zero if a render is needed +// play_move_rotate(byte register(A) key_event) play_move_rotate: { .label orientation = $a cmp #KEY_Z @@ -653,6 +656,7 @@ play_move_rotate: { } // Test if there is a collision between the current piece moved to (x, y) and anything on the playfield or the playfield boundaries // Returns information about the type of the collision detected +// play_collision(byte zeropage($c) xpos, byte zeropage($b) ypos, byte register(X) orientation) play_collision: { .label xpos = $c .label ypos = $b @@ -746,6 +750,7 @@ play_collision: { } // Move left/right or rotate the current piece // Return non-zero if a render is needed +// play_move_leftright(byte register(A) key_event) play_move_leftright: { // Handle keyboard events cmp #KEY_COMMA @@ -792,6 +797,7 @@ play_move_leftright: { } // Move down the current piece // Return non-zero if a render is needed +// play_move_down(byte register(A) key_event) play_move_down: { inc current_movedown_counter cmp #KEY_SPACE @@ -913,6 +919,7 @@ sid_rnd: { rts } // Update the score based on the number of lines removed +// play_update_score(byte register(X) removed) play_update_score: { .label lines_before = 4 .label add_bcd = $2b @@ -1139,6 +1146,7 @@ play_lock_current: { } // Determine if a specific key is currently pressed based on the last keyboard_event_scan() // Returns 0 is not pressed and non-0 if pressed +// keyboard_event_pressed(byte zeropage(9) keycode) keyboard_event_pressed: { .label row_bits = $a .label keycode = 9 @@ -1283,6 +1291,7 @@ keyboard_event_scan: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(X) rowid) keyboard_matrix_read: { lda keyboard_matrix_row_bitmask,x sta CIA1_PORT_A @@ -1509,6 +1518,7 @@ render_init: { } // Copy the original screen data to the passed screen // Also copies colors to $d800 +// render_screen_original(byte* zeropage($11) screen) render_screen_original: { .const SPACE = 0 .label screen = $11 diff --git a/src/test/ref/complex/tetris/tetris.log b/src/test/ref/complex/tetris/tetris.log index d50e2c4fa..2b740f05c 100644 --- a/src/test/ref/complex/tetris/tetris.log +++ b/src/test/ref/complex/tetris/tetris.log @@ -13620,6 +13620,7 @@ render_score: { // - offset: offset on the screen // - bcd: The BCD-value to render // - only_low: if non-zero only renders the low digit +// render_bcd(byte* zeropage(7) screen, word zeropage(9) offset, byte zeropage($c) bcd, byte zeropage($b) only_low) render_bcd: { .const ZERO_CHAR = $35 .label _3 = $81 @@ -14076,6 +14077,7 @@ render_playfield: { // Perform any movement of the current piece // key_event is the next keyboard_event() og $ff if no keyboard event is pending // Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed) +// play_movement(byte zeropage($7e) key_event) play_movement: { .label _0 = $92 .label _3 = $95 @@ -14165,6 +14167,7 @@ play_movement: { //SEG422 play_move_rotate // Rotate the current piece based on key-presses // Return non-zero if a render is needed +// play_move_rotate(byte zeropage($97) key_event) play_move_rotate: { .label _2 = $9a .label _4 = $9d @@ -14288,6 +14291,7 @@ play_move_rotate: { //SEG462 play_collision // Test if there is a collision between the current piece moved to (x, y) and anything on the playfield or the playfield boundaries // Returns information about the type of the collision detected +// play_collision(byte zeropage($2f) xpos, byte zeropage($2e) ypos, byte zeropage($2d) orientation) play_collision: { .label _7 = $a3 .label xpos = $2f @@ -14476,6 +14480,7 @@ play_collision: { //SEG520 play_move_leftright // Move left/right or rotate the current piece // Return non-zero if a render is needed +// play_move_leftright(byte zeropage($93) key_event) play_move_leftright: { .label _4 = $a5 .label _8 = $a7 @@ -14607,6 +14612,7 @@ play_move_leftright: { //SEG566 play_move_down // Move down the current piece // Return non-zero if a render is needed +// play_move_down(byte zeropage($90) key_event) play_move_down: { .label _2 = $a9 .label _12 = $ab @@ -15019,6 +15025,7 @@ sid_rnd: { } //SEG742 play_update_score // Update the score based on the number of lines removed +// play_update_score(byte zeropage($ae) removed) play_update_score: { .label _2 = $b6 .label _4 = $b8 @@ -15503,6 +15510,7 @@ play_lock_current: { //SEG896 keyboard_event_pressed // Determine if a specific key is currently pressed based on the last keyboard_event_scan() // Returns 0 is not pressed and non-0 if pressed +// keyboard_event_pressed(byte zeropage($58) keycode) keyboard_event_pressed: { .label _0 = $c5 .label _1 = $c7 @@ -15904,6 +15912,7 @@ keyboard_event_scan: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte zeropage($c9) rowid) keyboard_matrix_read: { .label return = $d9 .label rowid = $c9 @@ -16347,6 +16356,7 @@ render_init: { //SEG1151 render_screen_original // Copy the original screen data to the passed screen // Also copies colors to $d800 +// render_screen_original(byte* zeropage($71) screen) render_screen_original: { .const SPACE = 0 .label screen = $71 @@ -18814,6 +18824,7 @@ render_score: { // - offset: offset on the screen // - bcd: The BCD-value to render // - only_low: if non-zero only renders the low digit +// render_bcd(byte* zeropage(5) screen, word zeropage(7) offset, byte register(X) bcd, byte register(Y) only_low) render_bcd: { .const ZERO_CHAR = $35 .label screen = 5 @@ -19232,6 +19243,7 @@ render_playfield: { // Perform any movement of the current piece // key_event is the next keyboard_event() og $ff if no keyboard event is pending // Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed) +// play_movement(byte zeropage($29) key_event) play_movement: { .label render = 9 .label return = 9 @@ -19299,6 +19311,7 @@ play_movement: { //SEG422 play_move_rotate // Rotate the current piece based on key-presses // Return non-zero if a render is needed +// play_move_rotate(byte register(A) key_event) play_move_rotate: { .label orientation = $a //SEG423 [182] if((byte) play_move_rotate::key_event#0==(const byte) KEY_Z#0) goto play_move_rotate::@1 -- vbuaa_eq_vbuc1_then_la1 @@ -19402,6 +19415,7 @@ play_move_rotate: { //SEG462 play_collision // Test if there is a collision between the current piece moved to (x, y) and anything on the playfield or the playfield boundaries // Returns information about the type of the collision detected +// play_collision(byte zeropage($c) xpos, byte zeropage($b) ypos, byte register(X) orientation) play_collision: { .label xpos = $c .label ypos = $b @@ -19570,6 +19584,7 @@ play_collision: { //SEG520 play_move_leftright // Move left/right or rotate the current piece // Return non-zero if a render is needed +// play_move_leftright(byte register(A) key_event) play_move_leftright: { //SEG521 [225] if((byte) play_move_leftright::key_event#0==(const byte) KEY_COMMA#0) goto play_move_leftright::@1 -- vbuaa_eq_vbuc1_then_la1 // Handle keyboard events @@ -19680,6 +19695,7 @@ play_move_leftright: { //SEG566 play_move_down // Move down the current piece // Return non-zero if a render is needed +// play_move_down(byte register(A) key_event) play_move_down: { //SEG567 [247] (byte) current_movedown_counter#12 ← ++ (byte) current_movedown_counter#16 -- vbuz1=_inc_vbuz1 inc current_movedown_counter @@ -20043,6 +20059,7 @@ sid_rnd: { } //SEG742 play_update_score // Update the score based on the number of lines removed +// play_update_score(byte register(X) removed) play_update_score: { .label lines_before = 4 .label add_bcd = $2b @@ -20492,6 +20509,7 @@ play_lock_current: { //SEG896 keyboard_event_pressed // Determine if a specific key is currently pressed based on the last keyboard_event_scan() // Returns 0 is not pressed and non-0 if pressed +// keyboard_event_pressed(byte zeropage(9) keycode) keyboard_event_pressed: { .label row_bits = $a .label keycode = 9 @@ -20831,6 +20849,7 @@ keyboard_event_scan: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(X) rowid) keyboard_matrix_read: { //SEG1024 [448] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) -- _deref_pbuc1=pbuc2_derefidx_vbuxx lda keyboard_matrix_row_bitmask,x @@ -21241,6 +21260,7 @@ render_init: { //SEG1151 render_screen_original // Copy the original screen data to the passed screen // Also copies colors to $d800 +// render_screen_original(byte* zeropage($11) screen) render_screen_original: { .const SPACE = 0 .label screen = $11 @@ -24274,6 +24294,7 @@ render_score: { // - offset: offset on the screen // - bcd: The BCD-value to render // - only_low: if non-zero only renders the low digit +// render_bcd(byte* zeropage(5) screen, word zeropage(7) offset, byte register(X) bcd, byte register(Y) only_low) render_bcd: { .const ZERO_CHAR = $35 .label screen = 5 @@ -24634,6 +24655,7 @@ render_playfield: { // Perform any movement of the current piece // key_event is the next keyboard_event() og $ff if no keyboard event is pending // Returns a byte signaling whether rendering is needed. (0 no render, >0 render needed) +// play_movement(byte zeropage($29) key_event) play_movement: { .label render = 9 .label return = 9 @@ -24692,6 +24714,7 @@ play_movement: { //SEG422 play_move_rotate // Rotate the current piece based on key-presses // Return non-zero if a render is needed +// play_move_rotate(byte register(A) key_event) play_move_rotate: { .label orientation = $a //SEG423 [182] if((byte) play_move_rotate::key_event#0==(const byte) KEY_Z#0) goto play_move_rotate::@1 -- vbuaa_eq_vbuc1_then_la1 @@ -24781,6 +24804,7 @@ play_move_rotate: { //SEG462 play_collision // Test if there is a collision between the current piece moved to (x, y) and anything on the playfield or the playfield boundaries // Returns information about the type of the collision detected +// play_collision(byte zeropage($c) xpos, byte zeropage($b) ypos, byte register(X) orientation) play_collision: { .label xpos = $c .label ypos = $b @@ -24932,6 +24956,7 @@ play_collision: { //SEG520 play_move_leftright // Move left/right or rotate the current piece // Return non-zero if a render is needed +// play_move_leftright(byte register(A) key_event) play_move_leftright: { //SEG521 [225] if((byte) play_move_leftright::key_event#0==(const byte) KEY_COMMA#0) goto play_move_leftright::@1 -- vbuaa_eq_vbuc1_then_la1 // Handle keyboard events @@ -25024,6 +25049,7 @@ play_move_leftright: { //SEG566 play_move_down // Move down the current piece // Return non-zero if a render is needed +// play_move_down(byte register(A) key_event) play_move_down: { //SEG567 [247] (byte) current_movedown_counter#12 ← ++ (byte) current_movedown_counter#16 -- vbuz1=_inc_vbuz1 inc current_movedown_counter @@ -25321,6 +25347,7 @@ sid_rnd: { } //SEG742 play_update_score // Update the score based on the number of lines removed +// play_update_score(byte register(X) removed) play_update_score: { .label lines_before = 4 .label add_bcd = $2b @@ -25701,6 +25728,7 @@ play_lock_current: { //SEG896 keyboard_event_pressed // Determine if a specific key is currently pressed based on the last keyboard_event_scan() // Returns 0 is not pressed and non-0 if pressed +// keyboard_event_pressed(byte zeropage(9) keycode) keyboard_event_pressed: { .label row_bits = $a .label keycode = 9 @@ -25972,6 +26000,7 @@ keyboard_event_scan: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(X) rowid) keyboard_matrix_read: { //SEG1024 [448] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) -- _deref_pbuc1=pbuc2_derefidx_vbuxx lda keyboard_matrix_row_bitmask,x @@ -26326,6 +26355,7 @@ render_init: { //SEG1151 render_screen_original // Copy the original screen data to the passed screen // Also copies colors to $d800 +// render_screen_original(byte* zeropage($11) screen) render_screen_original: { .const SPACE = 0 .label screen = $11 diff --git a/src/test/ref/const-identification.asm b/src/test/ref/const-identification.asm index f96f7765b..9caf57dab 100644 --- a/src/test/ref/const-identification.asm +++ b/src/test/ref/const-identification.asm @@ -29,6 +29,7 @@ line: { beq b3 rts } +// plot(byte register(X) x) plot: { ldy plots,x lda SCREEN,y diff --git a/src/test/ref/const-identification.log b/src/test/ref/const-identification.log index 9caf014ee..66377c030 100644 --- a/src/test/ref/const-identification.log +++ b/src/test/ref/const-identification.log @@ -391,6 +391,7 @@ line: { rts } //SEG37 plot +// plot(byte zeropage(4) x) plot: { .label _0 = 6 .label x = 4 @@ -537,6 +538,7 @@ line: { rts } //SEG37 plot +// plot(byte register(X) x) plot: { //SEG38 [19] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#1) -- vbuyy=pbuc1_derefidx_vbuxx ldy plots,x @@ -705,6 +707,7 @@ line: { rts } //SEG37 plot +// plot(byte register(X) x) plot: { //SEG38 [19] (byte) plot::idx#0 ← *((const byte*) plots#0 + (byte) plot::x#1) -- vbuyy=pbuc1_derefidx_vbuxx ldy plots,x diff --git a/src/test/ref/const-param.asm b/src/test/ref/const-param.asm index dec68875b..d9b79316c 100644 --- a/src/test/ref/const-param.asm +++ b/src/test/ref/const-param.asm @@ -16,6 +16,7 @@ main: { sta screen+2 rts } +// sum(byte register(A) b) sum: { clc adc #main.reverse diff --git a/src/test/ref/const-param.log b/src/test/ref/const-param.log index c646676cc..c0445ff2f 100644 --- a/src/test/ref/const-param.log +++ b/src/test/ref/const-param.log @@ -336,6 +336,7 @@ main: { rts } //SEG34 sum +// sum(byte zeropage(2) b) sum: { .label return = 3 .label return_1 = 5 @@ -451,6 +452,7 @@ main: { rts } //SEG34 sum +// sum(byte register(A) b) sum: { //SEG35 [19] (byte) sum::return#3 ← (const byte) main::reverse#0 + (byte) sum::b#3 -- vbuaa=vbuc1_plus_vbuaa clc @@ -585,6 +587,7 @@ main: { rts } //SEG34 sum +// sum(byte register(A) b) sum: { //SEG35 [19] (byte) sum::return#3 ← (const byte) main::reverse#0 + (byte) sum::b#3 -- vbuaa=vbuc1_plus_vbuaa clc diff --git a/src/test/ref/constants.asm b/src/test/ref/constants.asm index 66e0cb391..3249e5e1a 100644 --- a/src/test/ref/constants.asm +++ b/src/test/ref/constants.asm @@ -68,6 +68,7 @@ test_sbytes: { msg3: .text "-(0+2-4)=2@" msg4: .text "-127-127=2@" } +// assert_sbyte(byte* zeropage(2) msg, signed byte register(X) b, signed byte zeropage(4) c) assert_sbyte: { .label msg = 2 .label c = 4 @@ -105,6 +106,7 @@ assert_sbyte: { str2: .text "ok@" } // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 b1: @@ -197,6 +199,7 @@ test_bytes: { msg1: .text "0+2=2@" msg2: .text "0+2-4=254@" } +// assert_byte(byte* zeropage(2) msg, byte register(X) b, byte zeropage(4) c) assert_byte: { .label msg = 2 .label c = 4 diff --git a/src/test/ref/constants.log b/src/test/ref/constants.log index 12b7ea387..8e4b8214d 100644 --- a/src/test/ref/constants.log +++ b/src/test/ref/constants.log @@ -1506,6 +1506,7 @@ test_sbytes: { msg4: .text "-127-127=2@" } //SEG59 assert_sbyte +// assert_sbyte(byte* zeropage(2) msg, signed byte zeropage(4) b, signed byte zeropage(5) c) assert_sbyte: { .label msg = 2 .label b = 4 @@ -1601,6 +1602,7 @@ assert_sbyte: { } //SEG93 print_str // Print a zero-terminated string +// print_str(byte* zeropage(8) str) print_str: { .label str = 8 //SEG94 [37] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -1764,6 +1766,7 @@ test_bytes: { msg2: .text "0+2-4=254@" } //SEG141 assert_byte +// assert_byte(byte* zeropage($c) msg, byte zeropage($e) b, byte zeropage($f) c) assert_byte: { .label msg = $c .label b = $e @@ -2142,6 +2145,7 @@ test_sbytes: { msg4: .text "-127-127=2@" } //SEG59 assert_sbyte +// assert_sbyte(byte* zeropage(2) msg, signed byte register(X) b, signed byte zeropage(4) c) assert_sbyte: { .label msg = 2 .label c = 4 @@ -2231,6 +2235,7 @@ assert_sbyte: { } //SEG93 print_str // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 //SEG94 [37] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -2391,6 +2396,7 @@ test_bytes: { msg2: .text "0+2-4=254@" } //SEG141 assert_byte +// assert_byte(byte* zeropage(2) msg, byte register(X) b, byte zeropage(4) c) assert_byte: { .label msg = 2 .label c = 4 @@ -2887,6 +2893,7 @@ test_sbytes: { msg4: .text "-127-127=2@" } //SEG59 assert_sbyte +// assert_sbyte(byte* zeropage(2) msg, signed byte register(X) b, signed byte zeropage(4) c) assert_sbyte: { .label msg = 2 .label c = 4 @@ -2958,6 +2965,7 @@ assert_sbyte: { } //SEG93 print_str // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 //SEG94 [37] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -3098,6 +3106,7 @@ test_bytes: { msg2: .text "0+2-4=254@" } //SEG141 assert_byte +// assert_byte(byte* zeropage(2) msg, byte register(X) b, byte zeropage(4) c) assert_byte: { .label msg = 2 .label c = 4 diff --git a/src/test/ref/examples/3d/3d.asm b/src/test/ref/examples/3d/3d.asm index e97612079..85e16ddfc 100644 --- a/src/test/ref/examples/3d/3d.asm +++ b/src/test/ref/examples/3d/3d.asm @@ -342,6 +342,7 @@ debug_print: { rts } // Print a signed byte as hex at a specific screen position +// print_sbyte_at(signed byte register(X) b, byte* zeropage(6) at) print_sbyte_at: { .label at = 6 cpx #0 @@ -368,6 +369,7 @@ print_sbyte_at: { jmp b2 } // Print a single char +// print_char_at(byte zeropage(8) ch, byte* zeropage(6) at) print_char_at: { .label at = 6 .label ch = 8 @@ -377,6 +379,7 @@ print_char_at: { rts } // Print a byte as HEX at a specific position +// print_byte_at(byte* zeropage(6) at) print_byte_at: { .label at = 6 txa @@ -404,6 +407,7 @@ print_byte_at: { // The rotation matrix is prepared by calling prepare_matrix() // The passed points must be in the interval [-$3f;$3f]. // Implemented in assembler to utilize seriously fast multiplication +// rotate_matrix(signed byte zeropage(5) x, signed byte register(Y) y, signed byte register(X) z) rotate_matrix: { .label x = 5 lda x @@ -545,6 +549,7 @@ store_matrix: { // Prepare the 3x3 rotation matrix into rotation_matrix[] // Angles sx, sy, sz are based on 2*PI=$100 // Method described in C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt +// calculate_matrix(signed byte register(X) sx, signed byte zeropage(3) sy) calculate_matrix: { .label sy = 3 .label t1 = 4 @@ -1051,6 +1056,7 @@ debug_print_init: { str11: .text "yp@" } // Print a string at a specific screen position +// print_str_at(byte* zeropage(6) str, byte* zeropage(9) at) print_str_at: { .label at = 9 .label str = 6 diff --git a/src/test/ref/examples/3d/3d.log b/src/test/ref/examples/3d/3d.log index 12c3a8932..89618daf2 100644 --- a/src/test/ref/examples/3d/3d.log +++ b/src/test/ref/examples/3d/3d.log @@ -6414,6 +6414,7 @@ debug_print: { } //SEG233 print_sbyte_at // Print a signed byte as hex at a specific screen position +// print_sbyte_at(signed byte zeropage(9) b, byte* zeropage(7) at) print_sbyte_at: { .label b = 9 .label at = 7 @@ -6486,6 +6487,7 @@ print_sbyte_at: { } //SEG256 print_char_at // Print a single char +// print_char_at(byte zeropage($a) ch, byte* zeropage($b) at) print_char_at: { .label at = $b .label ch = $a @@ -6501,6 +6503,7 @@ print_char_at: { } //SEG260 print_byte_at // Print a byte as HEX at a specific position +// print_byte_at(byte* zeropage($2a) at) print_byte_at: { .label _0 = $2c .label _2 = $2d @@ -6563,6 +6566,7 @@ print_byte_at: { // The rotation matrix is prepared by calling prepare_matrix() // The passed points must be in the interval [-$3f;$3f]. // Implemented in assembler to utilize seriously fast multiplication +// rotate_matrix(signed byte zeropage($19) x, signed byte zeropage($1a) y, signed byte zeropage($1b) z) rotate_matrix: { .label x = $19 .label y = $1a @@ -6721,6 +6725,7 @@ store_matrix: { // Prepare the 3x3 rotation matrix into rotation_matrix[] // Angles sx, sy, sz are based on 2*PI=$100 // Method described in C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt +// calculate_matrix(signed byte zeropage($17) sx, signed byte zeropage($18) sy) calculate_matrix: { .label _10 = $38 .label _11 = $39 @@ -7572,6 +7577,7 @@ debug_print_init: { } //SEG479 print_str_at // Print a string at a specific screen position +// print_str_at(byte* zeropage($10) str, byte* zeropage($12) at) print_str_at: { .label at = $12 .label str = $10 @@ -9164,6 +9170,7 @@ debug_print: { } //SEG233 print_sbyte_at // Print a signed byte as hex at a specific screen position +// print_sbyte_at(signed byte register(X) b, byte* zeropage(6) at) print_sbyte_at: { .label at = 6 //SEG234 [115] if((signed byte) print_sbyte_at::b#22<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte_at::@1 -- vbsxx_lt_0_then_la1 @@ -9224,6 +9231,7 @@ print_sbyte_at: { } //SEG256 print_char_at // Print a single char +// print_char_at(byte zeropage(8) ch, byte* zeropage(6) at) print_char_at: { .label at = 6 .label ch = 8 @@ -9239,6 +9247,7 @@ print_char_at: { } //SEG260 print_byte_at // Print a byte as HEX at a specific position +// print_byte_at(byte* zeropage(6) at) print_byte_at: { .label at = 6 //SEG261 [128] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#24 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 @@ -9290,6 +9299,7 @@ print_byte_at: { // The rotation matrix is prepared by calling prepare_matrix() // The passed points must be in the interval [-$3f;$3f]. // Implemented in assembler to utilize seriously fast multiplication +// rotate_matrix(signed byte zeropage(5) x, signed byte register(Y) y, signed byte register(X) z) rotate_matrix: { .label x = 5 //SEG279 [137] *((const signed byte*) xr#0) ← (signed byte) rotate_matrix::x#0 -- _deref_pbsc1=vbsz1 @@ -9446,6 +9456,7 @@ store_matrix: { // Prepare the 3x3 rotation matrix into rotation_matrix[] // Angles sx, sy, sz are based on 2*PI=$100 // Method described in C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt +// calculate_matrix(signed byte register(X) sx, signed byte zeropage(3) sy) calculate_matrix: { .label sy = 3 .label t1 = 4 @@ -10218,6 +10229,7 @@ debug_print_init: { } //SEG479 print_str_at // Print a string at a specific screen position +// print_str_at(byte* zeropage(6) str, byte* zeropage(9) at) print_str_at: { .label at = 9 .label str = 6 @@ -10728,8 +10740,8 @@ Succesful ASM optimization Pass5NextJumpElimination Removing instruction bbegin: Succesful ASM optimization Pass5UnusedLabelElimination Fixing long branch [338] bne b1 to beq -Fixing long branch [1025] bne b2 to beq -Fixing long branch [1035] bne b1 to beq +Fixing long branch [1030] bne b2 to beq +Fixing long branch [1040] bne b1 to beq FINAL SYMBOL TABLE (label) @33 @@ -11933,6 +11945,7 @@ debug_print: { } //SEG233 print_sbyte_at // Print a signed byte as hex at a specific screen position +// print_sbyte_at(signed byte register(X) b, byte* zeropage(6) at) print_sbyte_at: { .label at = 6 //SEG234 [115] if((signed byte) print_sbyte_at::b#22<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte_at::@1 -- vbsxx_lt_0_then_la1 @@ -11982,6 +11995,7 @@ print_sbyte_at: { } //SEG256 print_char_at // Print a single char +// print_char_at(byte zeropage(8) ch, byte* zeropage(6) at) print_char_at: { .label at = 6 .label ch = 8 @@ -11995,6 +12009,7 @@ print_char_at: { } //SEG260 print_byte_at // Print a byte as HEX at a specific position +// print_byte_at(byte* zeropage(6) at) print_byte_at: { .label at = 6 //SEG261 [128] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#24 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 @@ -12040,6 +12055,7 @@ print_byte_at: { // The rotation matrix is prepared by calling prepare_matrix() // The passed points must be in the interval [-$3f;$3f]. // Implemented in assembler to utilize seriously fast multiplication +// rotate_matrix(signed byte zeropage(5) x, signed byte register(Y) y, signed byte register(X) z) rotate_matrix: { .label x = 5 //SEG279 [137] *((const signed byte*) xr#0) ← (signed byte) rotate_matrix::x#0 -- _deref_pbsc1=vbsz1 @@ -12192,6 +12208,7 @@ store_matrix: { // Prepare the 3x3 rotation matrix into rotation_matrix[] // Angles sx, sy, sz are based on 2*PI=$100 // Method described in C= Hacking Magazine Issue 8. http://www.ffd2.com/fridge/chacking/c=hacking8.txt +// calculate_matrix(signed byte register(X) sx, signed byte zeropage(3) sy) calculate_matrix: { .label sy = 3 .label t1 = 4 @@ -12888,6 +12905,7 @@ debug_print_init: { } //SEG479 print_str_at // Print a string at a specific screen position +// print_str_at(byte* zeropage(6) str, byte* zeropage(9) at) print_str_at: { .label at = 9 .label str = 6 diff --git a/src/test/ref/examples/3d/perspective.asm b/src/test/ref/examples/3d/perspective.asm index b118ee979..8922b93e6 100644 --- a/src/test/ref/examples/3d/perspective.asm +++ b/src/test/ref/examples/3d/perspective.asm @@ -114,6 +114,7 @@ print_ln: { rts } // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 b1: @@ -137,6 +138,7 @@ print_str: { jmp b1 } // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { txa lsr @@ -154,6 +156,7 @@ print_byte: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -193,6 +196,7 @@ perspective: { rts } // Print a signed byte as HEX +// print_sbyte(signed byte register(X) b) print_sbyte: { cpx #0 bmi b1 diff --git a/src/test/ref/examples/3d/perspective.log b/src/test/ref/examples/3d/perspective.log index d696ab3f4..f8dc76ed3 100644 --- a/src/test/ref/examples/3d/perspective.log +++ b/src/test/ref/examples/3d/perspective.log @@ -2225,6 +2225,7 @@ print_ln: { } //SEG105 print_str // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 //SEG106 [45] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -2266,6 +2267,7 @@ print_str: { } //SEG117 print_byte // Print a byte as HEX +// print_byte(byte zeropage(6) b) print_byte: { .label _0 = $12 .label _2 = $13 @@ -2312,6 +2314,7 @@ print_byte: { } //SEG133 print_char // Print a single char +// print_char(byte zeropage(7) ch) print_char: { .label ch = 7 //SEG134 [60] *((byte*) print_char_cursor#44) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuz2 @@ -2370,6 +2373,7 @@ perspective: { } //SEG145 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage($a) b) print_sbyte: { .label b = $a //SEG146 [69] if((signed byte) print_sbyte::b#4<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -3037,6 +3041,7 @@ print_ln: { } //SEG105 print_str // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 //SEG106 [45] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -3078,6 +3083,7 @@ print_str: { } //SEG117 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG118 [52] (byte~) print_byte::$0 ← (byte) print_byte::b#3 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -3117,6 +3123,7 @@ print_byte: { } //SEG133 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG134 [60] *((byte*) print_char_cursor#44) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa ldy #0 @@ -3173,6 +3180,7 @@ perspective: { } //SEG145 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte register(X) b) print_sbyte: { //SEG146 [69] if((signed byte) print_sbyte::b#4<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsxx_lt_0_then_la1 cpx #0 @@ -3997,6 +4005,7 @@ print_ln: { } //SEG105 print_str // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 //SEG106 [45] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -4032,6 +4041,7 @@ print_str: { } //SEG117 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG118 [52] (byte~) print_byte::$0 ← (byte) print_byte::b#3 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -4065,6 +4075,7 @@ print_byte: { } //SEG133 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG134 [60] *((byte*) print_char_cursor#44) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa ldy #0 @@ -4116,6 +4127,7 @@ perspective: { } //SEG145 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte register(X) b) print_sbyte: { //SEG146 [69] if((signed byte) print_sbyte::b#4<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsxx_lt_0_then_la1 cpx #0 diff --git a/src/test/ref/examples/bresenham/bitmap-bresenham.asm b/src/test/ref/examples/bresenham/bitmap-bresenham.asm index 3f3e1a800..d61159173 100644 --- a/src/test/ref/examples/bresenham/bitmap-bresenham.asm +++ b/src/test/ref/examples/bresenham/bitmap-bresenham.asm @@ -48,6 +48,7 @@ lines: { rts } // Draw a line on the bitmap +// bitmap_line(byte zeropage(5) x0, byte zeropage(8) x1, byte zeropage(6) y0, byte register(Y) y1) bitmap_line: { .label xd = 4 .label yd = 3 @@ -147,6 +148,7 @@ bitmap_line: { jsr bitmap_line_xdyi jmp breturn } +// bitmap_line_xdyi(byte register(X) x, byte zeropage(6) y, byte zeropage(5) x1, byte zeropage(4) xd, byte zeropage(3) yd) bitmap_line_xdyi: { .label _6 = 8 .label y = 6 @@ -181,6 +183,7 @@ bitmap_line_xdyi: { bne b1 rts } +// bitmap_plot(byte register(X) x, byte register(Y) y) bitmap_plot: { .label _0 = 9 .label plotter_x = 9 @@ -206,6 +209,7 @@ bitmap_plot: { sta (_0),y rts } +// bitmap_line_ydxi(byte zeropage(7) y, byte register(X) x, byte zeropage(6) y1, byte zeropage(3) yd, byte zeropage(4) xd) bitmap_line_ydxi: { .label y = 7 .label y1 = 6 @@ -238,6 +242,7 @@ bitmap_line_ydxi: { bne b1 rts } +// bitmap_line_xdyd(byte register(X) x, byte zeropage(6) y, byte zeropage(8) x1, byte zeropage(4) xd, byte zeropage(3) yd) bitmap_line_xdyd: { .label _6 = 7 .label y = 6 @@ -272,6 +277,7 @@ bitmap_line_xdyd: { bne b1 rts } +// bitmap_line_ydxd(byte zeropage(7) y, byte register(X) x, byte zeropage(6) y1, byte zeropage(3) yd, byte zeropage(4) xd) bitmap_line_ydxd: { .label y = 7 .label y1 = 6 diff --git a/src/test/ref/examples/bresenham/bitmap-bresenham.log b/src/test/ref/examples/bresenham/bitmap-bresenham.log index dd16a2d9f..a222be9f1 100644 --- a/src/test/ref/examples/bresenham/bitmap-bresenham.log +++ b/src/test/ref/examples/bresenham/bitmap-bresenham.log @@ -2953,6 +2953,7 @@ lines: { } //SEG43 bitmap_line // Draw a line on the bitmap +// bitmap_line(byte zeropage($28) x0, byte zeropage($29) x1, byte zeropage($2a) y0, byte zeropage($2b) y1) bitmap_line: { .label xd = $2f .label xd_1 = $2c @@ -3263,6 +3264,7 @@ bitmap_line: { jmp breturn } //SEG169 bitmap_line_xdyi +// bitmap_line_xdyi(byte zeropage(6) x, byte zeropage(7) y, byte zeropage(5) x1, byte zeropage(4) xd, byte zeropage(3) yd) bitmap_line_xdyi: { .label _6 = $32 .label x = 6 @@ -3343,6 +3345,7 @@ bitmap_line_xdyi: { rts } //SEG197 bitmap_plot +// bitmap_plot(byte zeropage(9) x, byte zeropage($a) y) bitmap_plot: { .label _0 = $37 .label _1 = $39 @@ -3387,6 +3390,7 @@ bitmap_plot: { rts } //SEG205 bitmap_line_ydxi +// bitmap_line_ydxi(byte zeropage($f) y, byte zeropage($e) x, byte zeropage($d) y1, byte zeropage($c) yd, byte zeropage($b) xd) bitmap_line_ydxi: { .label _6 = $3a .label y = $f @@ -3467,6 +3471,7 @@ bitmap_line_ydxi: { rts } //SEG233 bitmap_line_xdyd +// bitmap_line_xdyd(byte zeropage($14) x, byte zeropage($15) y, byte zeropage($13) x1, byte zeropage($12) xd, byte zeropage($11) yd) bitmap_line_xdyd: { .label _6 = $3b .label x = $14 @@ -3547,6 +3552,7 @@ bitmap_line_xdyd: { rts } //SEG261 bitmap_line_ydxd +// bitmap_line_ydxd(byte zeropage($1b) y, byte zeropage($1a) x, byte zeropage($19) y1, byte zeropage($18) yd, byte zeropage($17) xd) bitmap_line_ydxd: { .label _6 = $3c .label y = $1b @@ -4377,6 +4383,7 @@ lines: { } //SEG43 bitmap_line // Draw a line on the bitmap +// bitmap_line(byte zeropage(5) x0, byte zeropage(8) x1, byte zeropage(6) y0, byte register(Y) y1) bitmap_line: { .label xd = 4 .label yd = 3 @@ -4630,6 +4637,7 @@ bitmap_line: { jmp breturn } //SEG169 bitmap_line_xdyi +// bitmap_line_xdyi(byte register(X) x, byte zeropage(6) y, byte zeropage(5) x1, byte zeropage(4) xd, byte zeropage(3) yd) bitmap_line_xdyi: { .label _6 = 8 .label y = 6 @@ -4705,6 +4713,7 @@ bitmap_line_xdyi: { rts } //SEG197 bitmap_plot +// bitmap_plot(byte register(X) x, byte register(Y) y) bitmap_plot: { .label _0 = 9 .label plotter_x = 9 @@ -4741,6 +4750,7 @@ bitmap_plot: { rts } //SEG205 bitmap_line_ydxi +// bitmap_line_ydxi(byte zeropage(7) y, byte register(X) x, byte zeropage(6) y1, byte zeropage(3) yd, byte zeropage(4) xd) bitmap_line_ydxi: { .label y = 7 .label y1 = 6 @@ -4814,6 +4824,7 @@ bitmap_line_ydxi: { rts } //SEG233 bitmap_line_xdyd +// bitmap_line_xdyd(byte register(X) x, byte zeropage(6) y, byte zeropage(8) x1, byte zeropage(4) xd, byte zeropage(3) yd) bitmap_line_xdyd: { .label _6 = 7 .label y = 6 @@ -4889,6 +4900,7 @@ bitmap_line_xdyd: { rts } //SEG261 bitmap_line_ydxd +// bitmap_line_ydxd(byte zeropage(7) y, byte register(X) x, byte zeropage(6) y1, byte zeropage(3) yd, byte zeropage(4) xd) bitmap_line_ydxd: { .label y = 7 .label y1 = 6 @@ -5896,6 +5908,7 @@ lines: { } //SEG43 bitmap_line // Draw a line on the bitmap +// bitmap_line(byte zeropage(5) x0, byte zeropage(8) x1, byte zeropage(6) y0, byte register(Y) y1) bitmap_line: { .label xd = 4 .label yd = 3 @@ -6121,6 +6134,7 @@ bitmap_line: { jmp breturn } //SEG169 bitmap_line_xdyi +// bitmap_line_xdyi(byte register(X) x, byte zeropage(6) y, byte zeropage(5) x1, byte zeropage(4) xd, byte zeropage(3) yd) bitmap_line_xdyi: { .label _6 = 8 .label y = 6 @@ -6183,6 +6197,7 @@ bitmap_line_xdyi: { rts } //SEG197 bitmap_plot +// bitmap_plot(byte register(X) x, byte register(Y) y) bitmap_plot: { .label _0 = 9 .label plotter_x = 9 @@ -6216,6 +6231,7 @@ bitmap_plot: { rts } //SEG205 bitmap_line_ydxi +// bitmap_line_ydxi(byte zeropage(7) y, byte register(X) x, byte zeropage(6) y1, byte zeropage(3) yd, byte zeropage(4) xd) bitmap_line_ydxi: { .label y = 7 .label y1 = 6 @@ -6276,6 +6292,7 @@ bitmap_line_ydxi: { rts } //SEG233 bitmap_line_xdyd +// bitmap_line_xdyd(byte register(X) x, byte zeropage(6) y, byte zeropage(8) x1, byte zeropage(4) xd, byte zeropage(3) yd) bitmap_line_xdyd: { .label _6 = 7 .label y = 6 @@ -6338,6 +6355,7 @@ bitmap_line_xdyd: { rts } //SEG261 bitmap_line_ydxd +// bitmap_line_ydxd(byte zeropage(7) y, byte register(X) x, byte zeropage(6) y1, byte zeropage(3) yd, byte zeropage(4) xd) bitmap_line_ydxd: { .label y = 7 .label y1 = 6 diff --git a/src/test/ref/examples/chargen/chargen-analysis.asm b/src/test/ref/examples/chargen/chargen-analysis.asm index 363c0be82..0f9254bfe 100644 --- a/src/test/ref/examples/chargen/chargen-analysis.asm +++ b/src/test/ref/examples/chargen/chargen-analysis.asm @@ -214,6 +214,7 @@ main: { str3: .text "f7@" } // Render 8x8 char (ch) as pixels on char canvas #pos +// plot_chargen(byte register(Y) pos, byte register(A) ch, byte register(X) shift) plot_chargen: { .label _0 = 2 .label _1 = 2 @@ -305,6 +306,7 @@ plot_chargen: { rts } // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a) mul8u: { .const b = $a .label mb = $b @@ -345,6 +347,7 @@ mul8u: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte register(X) key) keyboard_key_pressed: { txa and #7 @@ -363,6 +366,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(X) rowid) keyboard_matrix_read: { lda keyboard_matrix_row_bitmask,x sta CIA1_PORT_A @@ -374,11 +378,13 @@ keyboard_matrix_read: { // ch is the character to get the key code for ($00-$3f) // Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled. // If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) . +// keyboard_get_keycode(byte register(X) ch) keyboard_get_keycode: { lda keyboard_char_keycodes,x rts } // Print a string at a specific screen position +// print_str_at(byte* zeropage(2) str, byte* zeropage(9) at) print_str_at: { .label at = 9 .label str = 2 diff --git a/src/test/ref/examples/chargen/chargen-analysis.log b/src/test/ref/examples/chargen/chargen-analysis.log index a997e7d01..82a3ce888 100644 --- a/src/test/ref/examples/chargen/chargen-analysis.log +++ b/src/test/ref/examples/chargen/chargen-analysis.log @@ -3151,6 +3151,7 @@ main: { } //SEG169 plot_chargen // Render 8x8 char (ch) as pixels on char canvas #pos +// plot_chargen(byte zeropage($b) pos, byte zeropage(9) ch, byte zeropage($a) shift) plot_chargen: { .label _0 = $2c .label _1 = $2e @@ -3355,6 +3356,7 @@ plot_chargen: { } //SEG228 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte zeropage($14) a) mul8u: { .const b = $a .label _1 = $35 @@ -3432,6 +3434,7 @@ mul8u: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte zeropage($19) key) keyboard_key_pressed: { .label _2 = $3a .label colidx = $36 @@ -3485,6 +3488,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte zeropage($38) rowid) keyboard_matrix_read: { .label return = $3c .label rowid = $38 @@ -3508,6 +3512,7 @@ keyboard_matrix_read: { // ch is the character to get the key code for ($00-$3f) // Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled. // If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) . +// keyboard_get_keycode(byte zeropage($28) ch) keyboard_get_keycode: { .label return = $3d .label ch = $28 @@ -3524,6 +3529,7 @@ keyboard_get_keycode: { } //SEG271 print_str_at // Print a string at a specific screen position +// print_str_at(byte* zeropage($1a) str, byte* zeropage($1c) at) print_str_at: { .label at = $1c .label str = $1a @@ -4260,6 +4266,7 @@ main: { } //SEG169 plot_chargen // Render 8x8 char (ch) as pixels on char canvas #pos +// plot_chargen(byte register(Y) pos, byte register(A) ch, byte register(X) shift) plot_chargen: { .label _0 = 2 .label _1 = 2 @@ -4437,6 +4444,7 @@ plot_chargen: { } //SEG228 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a) mul8u: { .const b = $a .label mb = $b @@ -4511,6 +4519,7 @@ mul8u: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte register(X) key) keyboard_key_pressed: { //SEG252 [114] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#6 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuyy=vbuxx_band_vbuc1 txa @@ -4544,6 +4553,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(X) rowid) keyboard_matrix_read: { //SEG263 [122] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) -- _deref_pbuc1=pbuc2_derefidx_vbuxx lda keyboard_matrix_row_bitmask,x @@ -4562,6 +4572,7 @@ keyboard_matrix_read: { // ch is the character to get the key code for ($00-$3f) // Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled. // If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) . +// keyboard_get_keycode(byte register(X) ch) keyboard_get_keycode: { //SEG268 [125] (byte) keyboard_get_keycode::return#0 ← *((const byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#0) -- vbuaa=pbuc1_derefidx_vbuxx lda keyboard_char_keycodes,x @@ -4573,6 +4584,7 @@ keyboard_get_keycode: { } //SEG271 print_str_at // Print a string at a specific screen position +// print_str_at(byte* zeropage(2) str, byte* zeropage(9) at) print_str_at: { .label at = 9 .label str = 2 @@ -5642,6 +5654,7 @@ main: { } //SEG169 plot_chargen // Render 8x8 char (ch) as pixels on char canvas #pos +// plot_chargen(byte register(Y) pos, byte register(A) ch, byte register(X) shift) plot_chargen: { .label _0 = 2 .label _1 = 2 @@ -5792,6 +5805,7 @@ plot_chargen: { } //SEG228 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a) mul8u: { .const b = $a .label mb = $b @@ -5855,6 +5869,7 @@ mul8u: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte register(X) key) keyboard_key_pressed: { //SEG252 [114] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#6 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuyy=vbuxx_band_vbuc1 txa @@ -5884,6 +5899,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(X) rowid) keyboard_matrix_read: { //SEG263 [122] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) -- _deref_pbuc1=pbuc2_derefidx_vbuxx lda keyboard_matrix_row_bitmask,x @@ -5900,6 +5916,7 @@ keyboard_matrix_read: { // ch is the character to get the key code for ($00-$3f) // Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled. // If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) . +// keyboard_get_keycode(byte register(X) ch) keyboard_get_keycode: { //SEG268 [125] (byte) keyboard_get_keycode::return#0 ← *((const byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#0) -- vbuaa=pbuc1_derefidx_vbuxx lda keyboard_char_keycodes,x @@ -5909,6 +5926,7 @@ keyboard_get_keycode: { } //SEG271 print_str_at // Print a string at a specific screen position +// print_str_at(byte* zeropage(2) str, byte* zeropage(9) at) print_str_at: { .label at = 9 .label str = 2 diff --git a/src/test/ref/examples/fastmultiply/fastmultiply8.asm b/src/test/ref/examples/fastmultiply/fastmultiply8.asm index d9141c847..1e4710c67 100644 --- a/src/test/ref/examples/fastmultiply/fastmultiply8.asm +++ b/src/test/ref/examples/fastmultiply/fastmultiply8.asm @@ -108,6 +108,7 @@ main: { rts } // Print a signed byte as hex at a specific screen position +// print_sbyte_at(signed byte zeropage($a) b, byte* zeropage(8) at) print_sbyte_at: { .label b = $a .label at = 8 @@ -135,6 +136,7 @@ print_sbyte_at: { jmp b2 } // Print a single char +// print_char_at(byte zeropage($b) ch, byte* zeropage(8) at) print_char_at: { .label at = 8 .label ch = $b @@ -144,6 +146,7 @@ print_char_at: { rts } // Print a byte as HEX at a specific position +// print_byte_at(byte* zeropage(8) at) print_byte_at: { .label at = 8 lda print_sbyte_at.b @@ -167,6 +170,7 @@ print_byte_at: { jsr print_char_at rts } +// fmul8(signed byte register(A) a, signed byte register(Y) b) fmul8: { sta ap tya diff --git a/src/test/ref/examples/fastmultiply/fastmultiply8.log b/src/test/ref/examples/fastmultiply/fastmultiply8.log index b9f01d5fd..5e3aafcba 100644 --- a/src/test/ref/examples/fastmultiply/fastmultiply8.log +++ b/src/test/ref/examples/fastmultiply/fastmultiply8.log @@ -1535,6 +1535,7 @@ main: { } //SEG74 print_sbyte_at // Print a signed byte as hex at a specific screen position +// print_sbyte_at(signed byte zeropage($d) b, byte* zeropage($b) at) print_sbyte_at: { .label b = $d .label at = $b @@ -1607,6 +1608,7 @@ print_sbyte_at: { } //SEG97 print_char_at // Print a single char +// print_char_at(byte zeropage($e) ch, byte* zeropage($f) at) print_char_at: { .label at = $f .label ch = $e @@ -1622,6 +1624,7 @@ print_char_at: { } //SEG101 print_byte_at // Print a byte as HEX at a specific position +// print_byte_at(byte* zeropage($1b) at) print_byte_at: { .label _0 = $1d .label _2 = $1e @@ -1680,6 +1683,7 @@ print_byte_at: { rts } //SEG119 fmul8 +// fmul8(signed byte zeropage($17) a, signed byte zeropage($18) b) fmul8: { .label a = $17 .label b = $18 @@ -2210,6 +2214,7 @@ main: { } //SEG74 print_sbyte_at // Print a signed byte as hex at a specific screen position +// print_sbyte_at(signed byte zeropage($a) b, byte* zeropage(8) at) print_sbyte_at: { .label b = $a .label at = 8 @@ -2271,6 +2276,7 @@ print_sbyte_at: { } //SEG97 print_char_at // Print a single char +// print_char_at(byte zeropage($b) ch, byte* zeropage(8) at) print_char_at: { .label at = 8 .label ch = $b @@ -2286,6 +2292,7 @@ print_char_at: { } //SEG101 print_byte_at // Print a byte as HEX at a specific position +// print_byte_at(byte* zeropage(8) at) print_byte_at: { .label at = 8 //SEG102 [49] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#6 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4 @@ -2333,6 +2340,7 @@ print_byte_at: { rts } //SEG119 fmul8 +// fmul8(signed byte register(A) a, signed byte register(Y) b) fmul8: { //SEG120 [58] *((const signed byte*) ap#0) ← (signed byte) fmul8::a#0 -- _deref_pbsc1=vbsaa sta ap @@ -2916,6 +2924,7 @@ main: { } //SEG74 print_sbyte_at // Print a signed byte as hex at a specific screen position +// print_sbyte_at(signed byte zeropage($a) b, byte* zeropage(8) at) print_sbyte_at: { .label b = $a .label at = 8 @@ -2966,6 +2975,7 @@ print_sbyte_at: { } //SEG97 print_char_at // Print a single char +// print_char_at(byte zeropage($b) ch, byte* zeropage(8) at) print_char_at: { .label at = 8 .label ch = $b @@ -2979,6 +2989,7 @@ print_char_at: { } //SEG101 print_byte_at // Print a byte as HEX at a specific position +// print_byte_at(byte* zeropage(8) at) print_byte_at: { .label at = 8 //SEG102 [49] (byte~) print_byte_at::$0 ← (byte)(signed byte) print_sbyte_at::b#6 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4 @@ -3020,6 +3031,7 @@ print_byte_at: { rts } //SEG119 fmul8 +// fmul8(signed byte register(A) a, signed byte register(Y) b) fmul8: { //SEG120 [58] *((const signed byte*) ap#0) ← (signed byte) fmul8::a#0 -- _deref_pbsc1=vbsaa sta ap diff --git a/src/test/ref/examples/helloworld/helloworld.asm b/src/test/ref/examples/helloworld/helloworld.asm index 261abbe56..bc939726f 100644 --- a/src/test/ref/examples/helloworld/helloworld.asm +++ b/src/test/ref/examples/helloworld/helloworld.asm @@ -34,6 +34,7 @@ print_ln: { rts } // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 lda #<$400 diff --git a/src/test/ref/examples/helloworld/helloworld.log b/src/test/ref/examples/helloworld/helloworld.log index 7f542cf49..e37f10683 100644 --- a/src/test/ref/examples/helloworld/helloworld.log +++ b/src/test/ref/examples/helloworld/helloworld.log @@ -407,6 +407,7 @@ print_ln: { } //SEG29 print_str // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 //SEG30 [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1] @@ -569,6 +570,7 @@ print_ln: { } //SEG29 print_str // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 //SEG30 [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1] @@ -760,6 +762,7 @@ print_ln: { } //SEG29 print_str // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 //SEG30 [15] phi from print_str to print_str::@1 [phi:print_str->print_str::@1] diff --git a/src/test/ref/examples/rotate/rotate.asm b/src/test/ref/examples/rotate/rotate.asm index 0a8edb92c..82d30f683 100644 --- a/src/test/ref/examples/rotate/rotate.asm +++ b/src/test/ref/examples/rotate/rotate.asm @@ -150,6 +150,7 @@ anim: { } // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8s_prepare(byte a) +// mulf8s_prepared(signed byte register(Y) b) mulf8s_prepared: { .label memA = $fd .label m = 5 @@ -199,6 +200,7 @@ mulf8u_prepared: { rts } // Prepare for fast multiply with an unsigned byte to a word result +// mulf8u_prepare(byte register(A) a) mulf8u_prepare: { .label memA = $fd sta memA diff --git a/src/test/ref/examples/rotate/rotate.log b/src/test/ref/examples/rotate/rotate.log index 2a7af7ba2..759e932bd 100644 --- a/src/test/ref/examples/rotate/rotate.log +++ b/src/test/ref/examples/rotate/rotate.log @@ -2658,6 +2658,7 @@ anim: { //SEG109 mulf8s_prepared // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8s_prepare(byte a) +// mulf8s_prepared(signed byte zeropage(5) b) mulf8s_prepared: { .label memA = $fd .label _4 = $41 @@ -2786,6 +2787,7 @@ mulf8u_prepared: { } //SEG140 mulf8u_prepare // Prepare for fast multiply with an unsigned byte to a word result +// mulf8u_prepare(byte zeropage(8) a) mulf8u_prepare: { .label memA = $fd .label a = 8 @@ -3682,6 +3684,7 @@ anim: { //SEG109 mulf8s_prepared // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8s_prepare(byte a) +// mulf8s_prepared(signed byte register(Y) b) mulf8s_prepared: { .label memA = $fd .label m = 5 @@ -3780,6 +3783,7 @@ mulf8u_prepared: { } //SEG140 mulf8u_prepare // Prepare for fast multiply with an unsigned byte to a word result +// mulf8u_prepare(byte register(A) a) mulf8u_prepare: { .label memA = $fd //SEG141 [84] *((const byte*) mulf8u_prepare::memA#0) ← (byte) mulf8u_prepare::a#2 -- _deref_pbuc1=vbuaa @@ -4786,6 +4790,7 @@ anim: { //SEG109 mulf8s_prepared // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8s_prepare(byte a) +// mulf8s_prepared(signed byte register(Y) b) mulf8s_prepared: { .label memA = $fd .label m = 5 @@ -4866,6 +4871,7 @@ mulf8u_prepared: { } //SEG140 mulf8u_prepare // Prepare for fast multiply with an unsigned byte to a word result +// mulf8u_prepare(byte register(A) a) mulf8u_prepare: { .label memA = $fd //SEG141 [84] *((const byte*) mulf8u_prepare::memA#0) ← (byte) mulf8u_prepare::a#2 -- _deref_pbuc1=vbuaa diff --git a/src/test/ref/examples/scrolllogo/scrolllogo.asm b/src/test/ref/examples/scrolllogo/scrolllogo.asm index ba5ec4f73..687e76cb9 100644 --- a/src/test/ref/examples/scrolllogo/scrolllogo.asm +++ b/src/test/ref/examples/scrolllogo/scrolllogo.asm @@ -111,6 +111,7 @@ loop: { dec BORDERCOL jmp b1 } +// render_logo(signed word zeropage(8) xpos) render_logo: { .label _3 = $e .label xpos = 8 @@ -238,6 +239,7 @@ render_logo: { // Generate signed word sinus table - with values in the range min-max. // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen2(signed word* zeropage(2) sintab) sin16s_gen2: { .const min = -$140 .const max = $140 @@ -328,6 +330,7 @@ sin16s_gen2: { } // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage($17) a) mul16s: { .label _5 = 2 .label _6 = $e @@ -369,6 +372,7 @@ mul16s: { rts } // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($10) a, word zeropage($e) b) mul16u: { .label mb = $12 .label a = $10 @@ -423,6 +427,7 @@ mul16u: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($a) x) sin16s: { .label _6 = $a .label x = $a @@ -598,6 +603,7 @@ sin16s: { } // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($19) v1, word zeropage($e) v2, byte register(X) select) mulu16_sel: { .label _0 = $a .label _1 = $a @@ -664,6 +670,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(8) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 8 @@ -714,6 +721,7 @@ divr16u: { rts } // Fill some memory with a value +// fill(byte register(X) val) fill: { .label end = 8 .label addr = 2 diff --git a/src/test/ref/examples/scrolllogo/scrolllogo.log b/src/test/ref/examples/scrolllogo/scrolllogo.log index 132ecdf2d..8facc7628 100644 --- a/src/test/ref/examples/scrolllogo/scrolllogo.log +++ b/src/test/ref/examples/scrolllogo/scrolllogo.log @@ -4346,6 +4346,7 @@ loop: { jmp b7 } //SEG75 render_logo +// render_logo(signed word zeropage($3b) xpos) render_logo: { .label _0 = $3d .label _1 = $3e @@ -4741,6 +4742,7 @@ render_logo: { // Generate signed word sinus table - with values in the range min-max. // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen2(signed word* zeropage($d) sintab) sin16s_gen2: { .const min = -$140 .const max = $140 @@ -4919,6 +4921,7 @@ sin16s_gen2: { //SEG217 mul16s // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage($5a) a) mul16s: { .label _5 = $6c .label _6 = $6e @@ -5019,6 +5022,7 @@ mul16s: { } //SEG239 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($17) a, word zeropage($15) b) mul16u: { .label _1 = $76 .label mb = $1d @@ -5113,6 +5117,7 @@ mul16u: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($22) x) sin16s: { .label _6 = $77 .label x = $22 @@ -5470,6 +5475,7 @@ sin16s: { //SEG344 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($28) v1, word zeropage($2a) v2, byte zeropage($2c) select) mulu16_sel: { .label _0 = $9b .label _1 = $9f @@ -5632,6 +5638,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage($2f) dividend, word zeropage($2d) rem) divr16u: { .label _1 = $b1 .label _2 = $b2 @@ -5753,6 +5760,7 @@ divr16u: { } //SEG414 fill // Fill some memory with a value +// fill(byte zeropage($34) val) fill: { .label end = $b5 .label addr = $35 @@ -6518,6 +6526,7 @@ loop: { jmp b7 } //SEG75 render_logo +// render_logo(signed word zeropage(8) xpos) render_logo: { .label _3 = $e .label xpos = 8 @@ -6825,6 +6834,7 @@ render_logo: { // Generate signed word sinus table - with values in the range min-max. // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen2(signed word* zeropage(2) sintab) sin16s_gen2: { .const min = -$140 .const max = $140 @@ -6963,6 +6973,7 @@ sin16s_gen2: { //SEG217 mul16s // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage($17) a) mul16s: { .label _5 = 2 .label _6 = $e @@ -7038,6 +7049,7 @@ mul16s: { } //SEG239 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($10) a, word zeropage($e) b) mul16u: { .label mb = $12 .label a = $10 @@ -7128,6 +7140,7 @@ mul16u: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($a) x) sin16s: { .label _6 = $a .label x = $a @@ -7417,6 +7430,7 @@ sin16s: { //SEG344 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($19) v1, word zeropage($e) v2, byte register(X) select) mulu16_sel: { .label _0 = $a .label _1 = $a @@ -7530,6 +7544,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(8) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 8 @@ -7636,6 +7651,7 @@ divr16u: { } //SEG414 fill // Fill some memory with a value +// fill(byte register(X) val) fill: { .label end = 8 .label addr = 2 @@ -8630,6 +8646,7 @@ loop: { //SEG74 [35] phi (word) xsin_idx#19 = (word) xsin_idx#3 [phi:loop::@16->loop::@7#0] -- register_copy } //SEG75 render_logo +// render_logo(signed word zeropage(8) xpos) render_logo: { .label _3 = $e .label xpos = 8 @@ -8866,6 +8883,7 @@ render_logo: { // Generate signed word sinus table - with values in the range min-max. // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen2(signed word* zeropage(2) sintab) sin16s_gen2: { .const min = -$140 .const max = $140 @@ -8989,6 +9007,7 @@ sin16s_gen2: { //SEG217 mul16s // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage($17) a) mul16s: { .label _5 = 2 .label _6 = $e @@ -9052,6 +9071,7 @@ mul16s: { } //SEG239 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($10) a, word zeropage($e) b) mul16u: { .label mb = $12 .label a = $10 @@ -9130,6 +9150,7 @@ mul16u: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($a) x) sin16s: { .label _6 = $a .label x = $a @@ -9386,6 +9407,7 @@ sin16s: { //SEG344 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($19) v1, word zeropage($e) v2, byte register(X) select) mulu16_sel: { .label _0 = $a .label _1 = $a @@ -9485,6 +9507,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(8) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 8 @@ -9572,6 +9595,7 @@ divr16u: { } //SEG414 fill // Fill some memory with a value +// fill(byte register(X) val) fill: { .label end = 8 .label addr = 2 diff --git a/src/test/ref/examples/showlogo/showlogo.asm b/src/test/ref/examples/showlogo/showlogo.asm index 13ae82748..721f244a7 100644 --- a/src/test/ref/examples/showlogo/showlogo.asm +++ b/src/test/ref/examples/showlogo/showlogo.asm @@ -63,6 +63,7 @@ main: { jmp b3 } // Fill some memory with a value +// fill(word zeropage(2) size, byte register(X) val) fill: { .label end = 2 .label addr = 4 diff --git a/src/test/ref/examples/showlogo/showlogo.log b/src/test/ref/examples/showlogo/showlogo.log index fa505e685..3a5490fff 100644 --- a/src/test/ref/examples/showlogo/showlogo.log +++ b/src/test/ref/examples/showlogo/showlogo.log @@ -1002,6 +1002,7 @@ main: { } //SEG44 fill // Fill some memory with a value +// fill(word zeropage(3) size, byte zeropage(5) val) fill: { .label end = 8 .label addr = 6 @@ -1228,6 +1229,7 @@ main: { } //SEG44 fill // Fill some memory with a value +// fill(word zeropage(2) size, byte register(X) val) fill: { .label end = 2 .label addr = 4 @@ -1577,6 +1579,7 @@ main: { } //SEG44 fill // Fill some memory with a value +// fill(word zeropage(2) size, byte register(X) val) fill: { .label end = 2 .label addr = 4 diff --git a/src/test/ref/examples/sinplotter/sine-plotter.asm b/src/test/ref/examples/sinplotter/sine-plotter.asm index 9db9c61f5..f3219c8d6 100644 --- a/src/test/ref/examples/sinplotter/sine-plotter.asm +++ b/src/test/ref/examples/sinplotter/sine-plotter.asm @@ -164,6 +164,7 @@ render_sine: { rts } // Plot a single dot in the bitmap +// bitmap_plot(word zeropage(4) x, byte register(X) y) bitmap_plot: { .label _1 = $10 .label plotter = 6 @@ -194,6 +195,7 @@ bitmap_plot: { sta (plotter),y rts } +// wrap_y(signed word zeropage(6) y) wrap_y: { .label y = 6 b1: @@ -232,6 +234,7 @@ wrap_y: { // Generate signed word sinus table - with values in the range min-max. // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen2(signed word* zeropage(2) sintab) sin16s_gen2: { .const min = -$140 .const max = $140 @@ -322,6 +325,7 @@ sin16s_gen2: { } // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage($17) a) mul16s: { .label _5 = 2 .label _6 = 6 @@ -363,6 +367,7 @@ mul16s: { rts } // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($10) a, word zeropage(6) b) mul16u: { .label mb = $12 .label a = $10 @@ -417,6 +422,7 @@ mul16u: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($c) x) sin16s: { .label _6 = $c .label x = $c @@ -592,6 +598,7 @@ sin16s: { } // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($19) v1, word zeropage(6) v2, byte register(X) select) mulu16_sel: { .label _0 = $c .label _1 = $c @@ -658,6 +665,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 diff --git a/src/test/ref/examples/sinplotter/sine-plotter.log b/src/test/ref/examples/sinplotter/sine-plotter.log index f50e3ee0f..e1318ca85 100644 --- a/src/test/ref/examples/sinplotter/sine-plotter.log +++ b/src/test/ref/examples/sinplotter/sine-plotter.log @@ -4084,6 +4084,7 @@ render_sine: { } //SEG102 bitmap_plot // Plot a single dot in the bitmap +// bitmap_plot(word zeropage(7) x, byte zeropage(6) y) bitmap_plot: { .label _1 = $53 .label _2 = $57 @@ -4129,6 +4130,7 @@ bitmap_plot: { rts } //SEG110 wrap_y +// wrap_y(signed word zeropage(9) y) wrap_y: { .label y = 9 .label return = $47 @@ -4198,6 +4200,7 @@ wrap_y: { // Generate signed word sinus table - with values in the range min-max. // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen2(signed word* zeropage($f) sintab) sin16s_gen2: { .const min = -$140 .const max = $140 @@ -4376,6 +4379,7 @@ sin16s_gen2: { //SEG160 mul16s // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage($63) a) mul16s: { .label _5 = $75 .label _6 = $77 @@ -4476,6 +4480,7 @@ mul16s: { } //SEG182 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($19) a, word zeropage($17) b) mul16u: { .label _1 = $7f .label mb = $1f @@ -4570,6 +4575,7 @@ mul16u: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($24) x) sin16s: { .label _6 = $80 .label x = $24 @@ -4927,6 +4933,7 @@ sin16s: { //SEG287 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($2a) v1, word zeropage($2c) v2, byte zeropage($2e) select) mulu16_sel: { .label _0 = $a4 .label _1 = $a8 @@ -5089,6 +5096,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage($31) dividend, word zeropage($2f) rem) divr16u: { .label _1 = $ba .label _2 = $bb @@ -6258,6 +6266,7 @@ render_sine: { } //SEG102 bitmap_plot // Plot a single dot in the bitmap +// bitmap_plot(word zeropage(4) x, byte register(X) y) bitmap_plot: { .label _1 = $10 .label plotter = 6 @@ -6299,6 +6308,7 @@ bitmap_plot: { rts } //SEG110 wrap_y +// wrap_y(signed word zeropage(6) y) wrap_y: { .label y = 6 //SEG111 [62] phi from wrap_y wrap_y::@2 to wrap_y::@1 [phi:wrap_y/wrap_y::@2->wrap_y::@1] @@ -6364,6 +6374,7 @@ wrap_y: { // Generate signed word sinus table - with values in the range min-max. // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen2(signed word* zeropage(2) sintab) sin16s_gen2: { .const min = -$140 .const max = $140 @@ -6502,6 +6513,7 @@ sin16s_gen2: { //SEG160 mul16s // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage($17) a) mul16s: { .label _5 = 2 .label _6 = 6 @@ -6577,6 +6589,7 @@ mul16s: { } //SEG182 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($10) a, word zeropage(6) b) mul16u: { .label mb = $12 .label a = $10 @@ -6667,6 +6680,7 @@ mul16u: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($c) x) sin16s: { .label _6 = $c .label x = $c @@ -6956,6 +6970,7 @@ sin16s: { //SEG287 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($19) v1, word zeropage(6) v2, byte register(X) select) mulu16_sel: { .label _0 = $c .label _1 = $c @@ -7069,6 +7084,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 @@ -8472,6 +8488,7 @@ render_sine: { } //SEG102 bitmap_plot // Plot a single dot in the bitmap +// bitmap_plot(word zeropage(4) x, byte register(X) y) bitmap_plot: { .label _1 = $10 .label plotter = 6 @@ -8510,6 +8527,7 @@ bitmap_plot: { rts } //SEG110 wrap_y +// wrap_y(signed word zeropage(6) y) wrap_y: { .label y = 6 //SEG111 [62] phi from wrap_y wrap_y::@2 to wrap_y::@1 [phi:wrap_y/wrap_y::@2->wrap_y::@1] @@ -8565,6 +8583,7 @@ wrap_y: { // Generate signed word sinus table - with values in the range min-max. // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen2(signed word* zeropage(2) sintab) sin16s_gen2: { .const min = -$140 .const max = $140 @@ -8688,6 +8707,7 @@ sin16s_gen2: { //SEG160 mul16s // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage($17) a) mul16s: { .label _5 = 2 .label _6 = 6 @@ -8751,6 +8771,7 @@ mul16s: { } //SEG182 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($10) a, word zeropage(6) b) mul16u: { .label mb = $12 .label a = $10 @@ -8829,6 +8850,7 @@ mul16u: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($c) x) sin16s: { .label _6 = $c .label x = $c @@ -9085,6 +9107,7 @@ sin16s: { //SEG287 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($19) v1, word zeropage(6) v2, byte register(X) select) mulu16_sel: { .label _0 = $c .label _1 = $c @@ -9184,6 +9207,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 diff --git a/src/test/ref/examples/sinsprites/sinus-sprites.asm b/src/test/ref/examples/sinsprites/sinus-sprites.asm index 9b8ea44aa..bd0dbc699 100644 --- a/src/test/ref/examples/sinsprites/sinus-sprites.asm +++ b/src/test/ref/examples/sinsprites/sinus-sprites.asm @@ -194,6 +194,7 @@ clear_screen: { // - length is the length of the sine table // - min is the minimum value of the generated sinus // - max is the maximum value of the generated sinus +// gen_sintab(byte* zeropage(8) sintab, byte zeropage(3) length, byte zeropage(2) min, byte register(X) max) gen_sintab: { // amplitude/2 .label f_2pi = $e2e5 @@ -359,6 +360,7 @@ addMEMtoFAC: { rts } // Prepare MEM pointers for operations using MEM +// prepareMEM(byte* zeropage($c) mem) prepareMEM: { .label mem = $c lda mem @@ -370,6 +372,7 @@ prepareMEM: { // FAC = MEM*FAC // Set FAC to MEM (float saved in memory) multiplied by FAC (float accumulator) // Reads 5 bytes from memory +// mulFACbyMEM(byte* zeropage($c) mem) mulFACbyMEM: { .label mem = $c jsr prepareMEM @@ -388,6 +391,7 @@ sinFAC: { // FAC = MEM/FAC // Set FAC to MEM (float saved in memory) divided by FAC (float accumulator) // Reads 5 bytes from memory +// divMEMbyFAC(byte* zeropage($c) mem) divMEMbyFAC: { .label mem = $c jsr prepareMEM @@ -398,6 +402,7 @@ divMEMbyFAC: { } // FAC = word // Set the FAC (floating point accumulator) to the integer value of a 16bit word +// setFAC(word zeropage($c) w) setFAC: { .label w = $c jsr prepareMEM @@ -410,6 +415,7 @@ setFAC: { // MEM = FAC // Stores the value of the FAC to memory // Stores 5 bytes (means it is necessary to allocate 5 bytes to avoid clobbering other data using eg. byte[] mem = {0, 0, 0, 0, 0};) +// setMEMtoFAC(byte* zeropage($c) mem) setMEMtoFAC: { .label mem = $c jsr prepareMEM @@ -431,6 +437,7 @@ setARGtoFAC: { rts } // Initialize the PETSCII progress bar +// progress_init(byte* zeropage($a) line) progress_init: { .label line = $a rts @@ -469,6 +476,7 @@ gen_sprites: { // Generate a sprite from a C64 CHARGEN character (by making each pixel 3x3 pixels large) // - c is the character to generate // - sprite is a pointer to the position of the sprite to generate +// gen_chargen_sprite(byte register(Y) ch, byte* zeropage($a) sprite) gen_chargen_sprite: { .label _0 = $c .label _1 = $c diff --git a/src/test/ref/examples/sinsprites/sinus-sprites.log b/src/test/ref/examples/sinsprites/sinus-sprites.log index 5ae202b46..13d185b4b 100644 --- a/src/test/ref/examples/sinsprites/sinus-sprites.log +++ b/src/test/ref/examples/sinsprites/sinus-sprites.log @@ -3960,6 +3960,7 @@ clear_screen: { // - length is the length of the sine table // - min is the minimum value of the generated sinus // - max is the maximum value of the generated sinus +// gen_sintab(byte* zeropage($f) sintab, byte zeropage($e) length, byte zeropage($d) min, byte zeropage($c) max) gen_sintab: { // amplitude/2 .label f_2pi = $e2e5 @@ -4371,6 +4372,7 @@ addMEMtoFAC: { } //SEG290 prepareMEM // Prepare MEM pointers for operations using MEM +// prepareMEM(byte* zeropage($15) mem) prepareMEM: { .label _0 = $3c .label _1 = $3d @@ -4397,6 +4399,7 @@ prepareMEM: { // FAC = MEM*FAC // Set FAC to MEM (float saved in memory) multiplied by FAC (float accumulator) // Reads 5 bytes from memory +// mulFACbyMEM(byte* zeropage($17) mem) mulFACbyMEM: { .label mem = $17 //SEG298 [143] (byte*) prepareMEM::mem#4 ← (byte*) mulFACbyMEM::mem#2 -- pbuz1=pbuz2 @@ -4439,6 +4442,7 @@ sinFAC: { // FAC = MEM/FAC // Set FAC to MEM (float saved in memory) divided by FAC (float accumulator) // Reads 5 bytes from memory +// divMEMbyFAC(byte* zeropage($19) mem) divMEMbyFAC: { .label mem = $19 //SEG311 [150] (byte*) prepareMEM::mem#3 ← (byte*) divMEMbyFAC::mem#2 -- pbuz1=pbuz2 @@ -4467,6 +4471,7 @@ divMEMbyFAC: { //SEG319 setFAC // FAC = word // Set the FAC (floating point accumulator) to the integer value of a 16bit word +// setFAC(word zeropage($1b) w) setFAC: { .label w = $1b //SEG320 [155] (byte*~) prepareMEM::mem#8 ← (byte*)(word) setFAC::w#5 -- pbuz1=pbuz2 @@ -4497,6 +4502,7 @@ setFAC: { // MEM = FAC // Stores the value of the FAC to memory // Stores 5 bytes (means it is necessary to allocate 5 bytes to avoid clobbering other data using eg. byte[] mem = {0, 0, 0, 0, 0};) +// setMEMtoFAC(byte* zeropage($1d) mem) setMEMtoFAC: { .label mem = $1d //SEG329 [160] (byte*) prepareMEM::mem#1 ← (byte*) setMEMtoFAC::mem#5 -- pbuz1=pbuz2 @@ -4548,6 +4554,7 @@ setARGtoFAC: { } //SEG345 progress_init // Initialize the PETSCII progress bar +// progress_init(byte* zeropage($13) line) progress_init: { .label line = $13 jmp breturn @@ -4617,6 +4624,7 @@ gen_sprites: { // Generate a sprite from a C64 CHARGEN character (by making each pixel 3x3 pixels large) // - c is the character to generate // - sprite is a pointer to the position of the sprite to generate +// gen_chargen_sprite(byte zeropage($3e) ch, byte* zeropage($29) sprite) gen_chargen_sprite: { .label _0 = $3f .label _1 = $41 @@ -5724,6 +5732,7 @@ clear_screen: { // - length is the length of the sine table // - min is the minimum value of the generated sinus // - max is the maximum value of the generated sinus +// gen_sintab(byte* zeropage(8) sintab, byte zeropage(3) length, byte zeropage(2) min, byte register(X) max) gen_sintab: { // amplitude/2 .label f_2pi = $e2e5 @@ -6122,6 +6131,7 @@ addMEMtoFAC: { } //SEG290 prepareMEM // Prepare MEM pointers for operations using MEM +// prepareMEM(byte* zeropage($c) mem) prepareMEM: { .label mem = $c //SEG291 [137] (byte~) prepareMEM::$0 ← < (byte*) prepareMEM::mem#5 -- vbuaa=_lo_pbuz1 @@ -6142,6 +6152,7 @@ prepareMEM: { // FAC = MEM*FAC // Set FAC to MEM (float saved in memory) multiplied by FAC (float accumulator) // Reads 5 bytes from memory +// mulFACbyMEM(byte* zeropage($c) mem) mulFACbyMEM: { .label mem = $c //SEG298 [143] (byte*) prepareMEM::mem#4 ← (byte*) mulFACbyMEM::mem#2 @@ -6180,6 +6191,7 @@ sinFAC: { // FAC = MEM/FAC // Set FAC to MEM (float saved in memory) divided by FAC (float accumulator) // Reads 5 bytes from memory +// divMEMbyFAC(byte* zeropage($c) mem) divMEMbyFAC: { .label mem = $c //SEG311 [150] (byte*) prepareMEM::mem#3 ← (byte*) divMEMbyFAC::mem#2 @@ -6204,6 +6216,7 @@ divMEMbyFAC: { //SEG319 setFAC // FAC = word // Set the FAC (floating point accumulator) to the integer value of a 16bit word +// setFAC(word zeropage($c) w) setFAC: { .label w = $c //SEG320 [155] (byte*~) prepareMEM::mem#8 ← (byte*)(word) setFAC::w#5 @@ -6230,6 +6243,7 @@ setFAC: { // MEM = FAC // Stores the value of the FAC to memory // Stores 5 bytes (means it is necessary to allocate 5 bytes to avoid clobbering other data using eg. byte[] mem = {0, 0, 0, 0, 0};) +// setMEMtoFAC(byte* zeropage($c) mem) setMEMtoFAC: { .label mem = $c //SEG329 [160] (byte*) prepareMEM::mem#1 ← (byte*) setMEMtoFAC::mem#5 @@ -6277,6 +6291,7 @@ setARGtoFAC: { } //SEG345 progress_init // Initialize the PETSCII progress bar +// progress_init(byte* zeropage($a) line) progress_init: { .label line = $a jmp breturn @@ -6345,6 +6360,7 @@ gen_sprites: { // Generate a sprite from a C64 CHARGEN character (by making each pixel 3x3 pixels large) // - c is the character to generate // - sprite is a pointer to the position of the sprite to generate +// gen_chargen_sprite(byte register(Y) ch, byte* zeropage($a) sprite) gen_chargen_sprite: { .label _0 = $c .label _1 = $c @@ -7712,6 +7728,7 @@ clear_screen: { // - length is the length of the sine table // - min is the minimum value of the generated sinus // - max is the maximum value of the generated sinus +// gen_sintab(byte* zeropage(8) sintab, byte zeropage(3) length, byte zeropage(2) min, byte register(X) max) gen_sintab: { // amplitude/2 .label f_2pi = $e2e5 @@ -8016,6 +8033,7 @@ addMEMtoFAC: { } //SEG290 prepareMEM // Prepare MEM pointers for operations using MEM +// prepareMEM(byte* zeropage($c) mem) prepareMEM: { .label mem = $c //SEG291 [137] (byte~) prepareMEM::$0 ← < (byte*) prepareMEM::mem#5 -- vbuaa=_lo_pbuz1 @@ -8034,6 +8052,7 @@ prepareMEM: { // FAC = MEM*FAC // Set FAC to MEM (float saved in memory) multiplied by FAC (float accumulator) // Reads 5 bytes from memory +// mulFACbyMEM(byte* zeropage($c) mem) mulFACbyMEM: { .label mem = $c //SEG298 [143] (byte*) prepareMEM::mem#4 ← (byte*) mulFACbyMEM::mem#2 @@ -8065,6 +8084,7 @@ sinFAC: { // FAC = MEM/FAC // Set FAC to MEM (float saved in memory) divided by FAC (float accumulator) // Reads 5 bytes from memory +// divMEMbyFAC(byte* zeropage($c) mem) divMEMbyFAC: { .label mem = $c //SEG311 [150] (byte*) prepareMEM::mem#3 ← (byte*) divMEMbyFAC::mem#2 @@ -8084,6 +8104,7 @@ divMEMbyFAC: { //SEG319 setFAC // FAC = word // Set the FAC (floating point accumulator) to the integer value of a 16bit word +// setFAC(word zeropage($c) w) setFAC: { .label w = $c //SEG320 [155] (byte*~) prepareMEM::mem#8 ← (byte*)(word) setFAC::w#5 @@ -8105,6 +8126,7 @@ setFAC: { // MEM = FAC // Stores the value of the FAC to memory // Stores 5 bytes (means it is necessary to allocate 5 bytes to avoid clobbering other data using eg. byte[] mem = {0, 0, 0, 0, 0};) +// setMEMtoFAC(byte* zeropage($c) mem) setMEMtoFAC: { .label mem = $c //SEG329 [160] (byte*) prepareMEM::mem#1 ← (byte*) setMEMtoFAC::mem#5 @@ -8143,6 +8165,7 @@ setARGtoFAC: { } //SEG345 progress_init // Initialize the PETSCII progress bar +// progress_init(byte* zeropage($a) line) progress_init: { .label line = $a //SEG346 progress_init::@return @@ -8201,6 +8224,7 @@ gen_sprites: { // Generate a sprite from a C64 CHARGEN character (by making each pixel 3x3 pixels large) // - c is the character to generate // - sprite is a pointer to the position of the sprite to generate +// gen_chargen_sprite(byte register(Y) ch, byte* zeropage($a) sprite) gen_chargen_sprite: { .label _0 = $c .label _1 = $c diff --git a/src/test/ref/fillscreen.asm b/src/test/ref/fillscreen.asm index 0d0519bc4..b8fdf7077 100644 --- a/src/test/ref/fillscreen.asm +++ b/src/test/ref/fillscreen.asm @@ -7,6 +7,7 @@ main: { jsr fillscreen rts } +// fillscreen(byte register(A) c) fillscreen: { .label SCREEN2 = SCREEN+$100 .label SCREEN3 = SCREEN+$200 diff --git a/src/test/ref/fillscreen.log b/src/test/ref/fillscreen.log index 07e5e6d1d..c478c4851 100644 --- a/src/test/ref/fillscreen.log +++ b/src/test/ref/fillscreen.log @@ -239,6 +239,7 @@ main: { rts } //SEG16 fillscreen +// fillscreen(byte zeropage(4) c) fillscreen: { .label SCREEN2 = SCREEN+$100 .label SCREEN3 = SCREEN+$200 @@ -338,6 +339,7 @@ main: { rts } //SEG16 fillscreen +// fillscreen(byte register(A) c) fillscreen: { .label SCREEN2 = SCREEN+$100 .label SCREEN3 = SCREEN+$200 @@ -459,6 +461,7 @@ main: { rts } //SEG16 fillscreen +// fillscreen(byte register(A) c) fillscreen: { .label SCREEN2 = SCREEN+$100 .label SCREEN3 = SCREEN+$200 diff --git a/src/test/ref/fragment-synth.asm b/src/test/ref/fragment-synth.asm index 10c7a15e5..828aabcc2 100644 --- a/src/test/ref/fragment-synth.asm +++ b/src/test/ref/fragment-synth.asm @@ -25,6 +25,7 @@ main: { sta screen+1 rts } +// fct(byte register(X) x, byte* zeropage(2) z) fct: { .label z = 2 ldy #2 diff --git a/src/test/ref/fragment-synth.log b/src/test/ref/fragment-synth.log index 4f2dd1557..171be236f 100644 --- a/src/test/ref/fragment-synth.log +++ b/src/test/ref/fragment-synth.log @@ -331,6 +331,7 @@ main: { rts } //SEG30 fct +// fct(byte register(X) x, byte* zeropage(2) z) fct: { .label return = 4 .label return_1 = 6 @@ -444,6 +445,7 @@ main: { rts } //SEG30 fct +// fct(byte register(X) x, byte* zeropage(2) z) fct: { .label z = 2 //SEG31 [16] (byte) fct::return#2 ← (byte) fct::x#2 & *((byte*) fct::z#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) -- vbuaa=vbuxx_band_pbuz1_derefidx_vbuc1 @@ -581,6 +583,7 @@ main: { rts } //SEG30 fct +// fct(byte register(X) x, byte* zeropage(2) z) fct: { .label z = 2 //SEG31 [16] (byte) fct::return#2 ← (byte) fct::x#2 & *((byte*) fct::z#2 + (byte/signed byte/word/signed word/dword/signed dword) 2) -- vbuaa=vbuxx_band_pbuz1_derefidx_vbuc1 diff --git a/src/test/ref/helloworld2.asm b/src/test/ref/helloworld2.asm index f371e847a..8341b803f 100644 --- a/src/test/ref/helloworld2.asm +++ b/src/test/ref/helloworld2.asm @@ -16,6 +16,7 @@ main: { rts hello: .text "hello world!@" } +// print2(byte* zeropage(2) at) print2: { .label at = 2 ldy #0 diff --git a/src/test/ref/helloworld2.log b/src/test/ref/helloworld2.log index a4794d043..29a878ef9 100644 --- a/src/test/ref/helloworld2.log +++ b/src/test/ref/helloworld2.log @@ -278,6 +278,7 @@ main: { hello: .text "hello world!@" } //SEG21 print2 +// print2(byte* zeropage(2) at) print2: { .label j = 5 .label i = 4 @@ -399,6 +400,7 @@ main: { hello: .text "hello world!@" } //SEG21 print2 +// print2(byte* zeropage(2) at) print2: { .label at = 2 //SEG22 [10] phi from print2 to print2::@1 [phi:print2->print2::@1] @@ -538,6 +540,7 @@ main: { hello: .text "hello world!@" } //SEG21 print2 +// print2(byte* zeropage(2) at) print2: { .label at = 2 //SEG22 [10] phi from print2 to print2::@1 [phi:print2->print2::@1] diff --git a/src/test/ref/incrementinarray.asm b/src/test/ref/incrementinarray.asm index 3b906874a..65e9c1321 100644 --- a/src/test/ref/incrementinarray.asm +++ b/src/test/ref/incrementinarray.asm @@ -53,6 +53,7 @@ print_ln: { rts } // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 lda #print_str::@1] @@ -885,6 +886,7 @@ print_ln: { } //SEG44 print_str // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 //SEG45 [21] phi from print_str to print_str::@1 [phi:print_str->print_str::@1] @@ -1178,6 +1180,7 @@ print_ln: { } //SEG44 print_str // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 //SEG45 [21] phi from print_str to print_str::@1 [phi:print_str->print_str::@1] diff --git a/src/test/ref/inline-string-2.asm b/src/test/ref/inline-string-2.asm index 29f414271..b28d18626 100644 --- a/src/test/ref/inline-string-2.asm +++ b/src/test/ref/inline-string-2.asm @@ -14,6 +14,7 @@ main: { jsr print_msg rts } +// print_msg(byte register(X) idx) print_msg: { .label msg = 4 cpx #1 @@ -34,6 +35,7 @@ print_msg: { msg_0: .text "Hello @" msg_1: .text "World!@" } +// print(byte* zeropage(4) msg) print: { .label msg = 4 b1: diff --git a/src/test/ref/inline-string-2.log b/src/test/ref/inline-string-2.log index 4d203eddb..867957043 100644 --- a/src/test/ref/inline-string-2.log +++ b/src/test/ref/inline-string-2.log @@ -371,6 +371,7 @@ main: { rts } //SEG23 print_msg +// print_msg(byte zeropage(2) idx) print_msg: { .label idx = 2 .label msg = 5 @@ -419,6 +420,7 @@ print_msg: { msg_1: .text "World!@" } //SEG37 print +// print(byte* zeropage(7) msg) print: { .label msg = 7 //SEG38 [17] phi from print print::@2 to print::@1 [phi:print/print::@2->print::@1] @@ -539,6 +541,7 @@ main: { rts } //SEG23 print_msg +// print_msg(byte register(X) idx) print_msg: { .label msg = 4 //SEG24 [10] if((byte) print_msg::idx#2==(byte/signed byte/word/signed word/dword/signed dword) 1) goto print_msg::@2 -- vbuxx_eq_vbuc1_then_la1 @@ -581,6 +584,7 @@ print_msg: { msg_1: .text "World!@" } //SEG37 print +// print(byte* zeropage(4) msg) print: { .label msg = 4 //SEG38 [17] phi from print print::@2 to print::@1 [phi:print/print::@2->print::@1] @@ -741,6 +745,7 @@ main: { rts } //SEG23 print_msg +// print_msg(byte register(X) idx) print_msg: { .label msg = 4 //SEG24 [10] if((byte) print_msg::idx#2==(byte/signed byte/word/signed word/dword/signed dword) 1) goto print_msg::@2 -- vbuxx_eq_vbuc1_then_la1 @@ -775,6 +780,7 @@ print_msg: { msg_1: .text "World!@" } //SEG37 print +// print(byte* zeropage(4) msg) print: { .label msg = 4 //SEG38 [17] phi from print print::@2 to print::@1 [phi:print/print::@2->print::@1] diff --git a/src/test/ref/inline-string.asm b/src/test/ref/inline-string.asm index 5a37c6080..8e2bdc467 100644 --- a/src/test/ref/inline-string.asm +++ b/src/test/ref/inline-string.asm @@ -27,6 +27,7 @@ main: { msg: .text "message 3 @" msg2: .text "message 2 @" } +// print(byte* zeropage(4) msg) print: { .label msg = 4 b1: diff --git a/src/test/ref/inline-string.log b/src/test/ref/inline-string.log index 62eb794d2..5d668e420 100644 --- a/src/test/ref/inline-string.log +++ b/src/test/ref/inline-string.log @@ -326,6 +326,7 @@ main: { msg2: .text "message 2 @" } //SEG29 print +// print(byte* zeropage(4) msg) print: { .label msg = 4 //SEG30 [12] phi from print print::@2 to print::@1 [phi:print/print::@2->print::@1] @@ -462,6 +463,7 @@ main: { msg2: .text "message 2 @" } //SEG29 print +// print(byte* zeropage(4) msg) print: { .label msg = 4 //SEG30 [12] phi from print print::@2 to print::@1 [phi:print/print::@2->print::@1] @@ -631,6 +633,7 @@ main: { msg2: .text "message 2 @" } //SEG29 print +// print(byte* zeropage(4) msg) print: { .label msg = 4 //SEG30 [12] phi from print print::@2 to print::@1 [phi:print/print::@2->print::@1] diff --git a/src/test/ref/keyboard-glitch.asm b/src/test/ref/keyboard-glitch.asm index 70f460f7e..89734ead1 100644 --- a/src/test/ref/keyboard-glitch.asm +++ b/src/test/ref/keyboard-glitch.asm @@ -63,6 +63,7 @@ menu: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte register(X) key) keyboard_key_pressed: { txa and #7 @@ -81,6 +82,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(X) rowid) keyboard_matrix_read: { lda keyboard_matrix_row_bitmask,x sta CIA1_PORT_A diff --git a/src/test/ref/keyboard-glitch.log b/src/test/ref/keyboard-glitch.log index 20a38ac40..82f0e1889 100644 --- a/src/test/ref/keyboard-glitch.log +++ b/src/test/ref/keyboard-glitch.log @@ -1511,6 +1511,7 @@ menu: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte zeropage(2) key) keyboard_key_pressed: { .label _2 = $d .label colidx = 9 @@ -1562,6 +1563,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte zeropage($b) rowid) keyboard_matrix_read: { .label return = $f .label rowid = $b @@ -1843,6 +1845,7 @@ menu: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte register(X) key) keyboard_key_pressed: { //SEG57 [32] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#4 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuyy=vbuxx_band_vbuc1 txa @@ -1876,6 +1879,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(X) rowid) keyboard_matrix_read: { //SEG68 [40] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) -- _deref_pbuc1=pbuc2_derefidx_vbuxx lda keyboard_matrix_row_bitmask,x @@ -2350,6 +2354,7 @@ menu: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte register(X) key) keyboard_key_pressed: { //SEG57 [32] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#4 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuyy=vbuxx_band_vbuc1 txa @@ -2379,6 +2384,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(X) rowid) keyboard_matrix_read: { //SEG68 [40] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#0) -- _deref_pbuc1=pbuc2_derefidx_vbuxx lda keyboard_matrix_row_bitmask,x diff --git a/src/test/ref/line-anim.asm b/src/test/ref/line-anim.asm index 55ff9f923..e27087fe3 100644 --- a/src/test/ref/line-anim.asm +++ b/src/test/ref/line-anim.asm @@ -81,6 +81,7 @@ main: { jmp b5 } // Plot a single dot in the bitmap +// bitmap_plot(word zeropage(5) x, byte register(Y) y) bitmap_plot: { .label _1 = $b .label x = 5 @@ -112,6 +113,7 @@ bitmap_plot: { rts } // Initialize the points to be animated +// point_init(byte zeropage(2) point_idx) point_init: { .label _4 = $e .label _5 = 5 @@ -276,6 +278,7 @@ point_init: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// divr16s(signed word zeropage($b) divisor, signed word zeropage(9) rem) divr16s: { .const dividend = 0 .label _7 = 9 @@ -362,6 +365,7 @@ divr16s: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(3) dividend, word zeropage($b) divisor, word zeropage(9) rem) divr16u: { .label rem = 9 .label dividend = 3 @@ -413,6 +417,7 @@ divr16u: { rts } // Fill the screen with a specific char +// screen_fill(byte* zeropage(3) screen) screen_fill: { .const ch = $10 .label screen = 3 diff --git a/src/test/ref/line-anim.log b/src/test/ref/line-anim.log index 42ce02dd4..392b4a14e 100644 --- a/src/test/ref/line-anim.log +++ b/src/test/ref/line-anim.log @@ -3294,6 +3294,7 @@ main: { } //SEG56 bitmap_plot // Plot a single dot in the bitmap +// bitmap_plot(word zeropage($28) x, byte zeropage($2a) y) bitmap_plot: { .label _1 = $2d .label _2 = $31 @@ -3340,6 +3341,7 @@ bitmap_plot: { } //SEG64 point_init // Initialize the points to be animated +// point_init(byte zeropage($26) point_idx) point_init: { .label _4 = $35 .label _5 = $37 @@ -3616,6 +3618,7 @@ point_init: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// divr16s(signed word zeropage($41) divisor, signed word zeropage($43) rem) divr16s: { .const dividend = 0 .label _7 = $57 @@ -3815,6 +3818,7 @@ divr16s: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage($14) dividend, word zeropage($4f) divisor, word zeropage($12) rem) divr16u: { .label _1 = $59 .label _2 = $5a @@ -3928,6 +3932,7 @@ divr16u: { } //SEG204 screen_fill // Fill the screen with a specific char +// screen_fill(byte* zeropage($1a) screen) screen_fill: { .const ch = $10 .label screen = $1a @@ -4717,6 +4722,7 @@ main: { } //SEG56 bitmap_plot // Plot a single dot in the bitmap +// bitmap_plot(word zeropage(5) x, byte register(Y) y) bitmap_plot: { .label _1 = $b .label x = 5 @@ -4759,6 +4765,7 @@ bitmap_plot: { } //SEG64 point_init // Initialize the points to be animated +// point_init(byte zeropage(2) point_idx) point_init: { .label _4 = $e .label _5 = 5 @@ -5005,6 +5012,7 @@ point_init: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// divr16s(signed word zeropage($b) divisor, signed word zeropage(9) rem) divr16s: { .const dividend = 0 .label _7 = 9 @@ -5159,6 +5167,7 @@ divr16s: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(3) dividend, word zeropage($b) divisor, word zeropage(9) rem) divr16u: { .label rem = 9 .label dividend = 3 @@ -5262,6 +5271,7 @@ divr16u: { } //SEG204 screen_fill // Fill the screen with a specific char +// screen_fill(byte* zeropage(3) screen) screen_fill: { .const ch = $10 .label screen = 3 @@ -5717,8 +5727,8 @@ Removing instruction b10: Succesful ASM optimization Pass5UnusedLabelElimination Removing unreachable instruction jmp b2 Succesful ASM optimization Pass5UnreachableCodeElimination -Fixing long branch [157] bmi abs16s1_b1 to bpl -Fixing long branch [166] bmi abs16s2_b1 to bpl +Fixing long branch [159] bmi abs16s1_b1 to bpl +Fixing long branch [168] bmi abs16s2_b1 to bpl FINAL SYMBOL TABLE (label) @19 @@ -6271,6 +6281,7 @@ main: { } //SEG56 bitmap_plot // Plot a single dot in the bitmap +// bitmap_plot(word zeropage(5) x, byte register(Y) y) bitmap_plot: { .label _1 = $b .label x = 5 @@ -6310,6 +6321,7 @@ bitmap_plot: { } //SEG64 point_init // Initialize the points to be animated +// point_init(byte zeropage(2) point_idx) point_init: { .label _4 = $e .label _5 = 5 @@ -6531,6 +6543,7 @@ point_init: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// divr16s(signed word zeropage($b) divisor, signed word zeropage(9) rem) divr16s: { .const dividend = 0 .label _7 = 9 @@ -6665,6 +6678,7 @@ divr16s: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(3) dividend, word zeropage($b) divisor, word zeropage(9) rem) divr16u: { .label rem = 9 .label dividend = 3 @@ -6751,6 +6765,7 @@ divr16u: { } //SEG204 screen_fill // Fill the screen with a specific char +// screen_fill(byte* zeropage(3) screen) screen_fill: { .const ch = $10 .label screen = 3 diff --git a/src/test/ref/linegen.asm b/src/test/ref/linegen.asm index b99c180d5..6cfb5814e 100644 --- a/src/test/ref/linegen.asm +++ b/src/test/ref/linegen.asm @@ -204,6 +204,7 @@ print_ln: { rts } // Print a word as HEX +// print_word(word zeropage(5) w) print_word: { .label w = 5 lda w+1 @@ -215,6 +216,7 @@ print_word: { rts } // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { txa lsr @@ -232,6 +234,7 @@ print_byte: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -242,6 +245,7 @@ print_char: { rts } // Print a zero-terminated string +// print_str(byte* zeropage(5) str) print_str: { .label str = 5 b1: @@ -290,6 +294,7 @@ print_cls: { // Generate word linear table // lintab - the table to generate into // length - the number of points in a total sinus wavelength (the size of the table) +// lin16u_gen(word zeropage(5) min, word zeropage(3) max, word* zeropage(7) lintab) lin16u_gen: { .label _5 = 5 .label ampl = 3 @@ -395,6 +400,7 @@ lin16u_gen: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(3) dividend, word zeropage($d) divisor, word zeropage($f) rem) divr16u: { .label rem = $f .label dividend = 3 diff --git a/src/test/ref/linegen.log b/src/test/ref/linegen.log index 402d876d5..2890d1ef1 100644 --- a/src/test/ref/linegen.log +++ b/src/test/ref/linegen.log @@ -2497,6 +2497,7 @@ print_ln: { } //SEG172 print_word // Print a word as HEX +// print_word(word zeropage(5) w) print_word: { .label w = 5 //SEG173 [67] (byte) print_byte::b#0 ← > (word) print_word::w#10 -- vbuz1=_hi_vwuz2 @@ -2528,6 +2529,7 @@ print_word: { } //SEG186 print_byte // Print a byte as HEX +// print_byte(byte zeropage(7) b) print_byte: { .label _0 = $24 .label _2 = $25 @@ -2574,6 +2576,7 @@ print_byte: { } //SEG202 print_char // Print a single char +// print_char(byte zeropage(8) ch) print_char: { .label ch = 8 //SEG203 [81] *((byte*) print_char_cursor#50) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuz2 @@ -2593,6 +2596,7 @@ print_char: { } //SEG207 print_str // Print a zero-terminated string +// print_str(byte* zeropage($b) str) print_str: { .label str = $b //SEG208 [85] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -2676,6 +2680,7 @@ print_cls: { // Generate word linear table // lintab - the table to generate into // length - the number of points in a total sinus wavelength (the size of the table) +// lin16u_gen(word zeropage($11) min, word zeropage($f) max, word* zeropage($17) lintab) lin16u_gen: { .label _5 = $34 .label ampl = $26 @@ -2856,6 +2861,7 @@ lin16u_gen: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage($1f) dividend, word zeropage($1b) divisor, word zeropage($1d) rem) divr16u: { .label _1 = $36 .label _2 = $37 @@ -3631,6 +3637,7 @@ print_ln: { } //SEG172 print_word // Print a word as HEX +// print_word(word zeropage(5) w) print_word: { .label w = 5 //SEG173 [67] (byte) print_byte::b#0 ← > (word) print_word::w#10 -- vbuxx=_hi_vwuz1 @@ -3662,6 +3669,7 @@ print_word: { } //SEG186 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG187 [73] (byte~) print_byte::$0 ← (byte) print_byte::b#3 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -3701,6 +3709,7 @@ print_byte: { } //SEG202 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG203 [81] *((byte*) print_char_cursor#50) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa ldy #0 @@ -3718,6 +3727,7 @@ print_char: { } //SEG207 print_str // Print a zero-terminated string +// print_str(byte* zeropage(5) str) print_str: { .label str = 5 //SEG208 [85] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -3801,6 +3811,7 @@ print_cls: { // Generate word linear table // lintab - the table to generate into // length - the number of points in a total sinus wavelength (the size of the table) +// lin16u_gen(word zeropage(5) min, word zeropage(3) max, word* zeropage(7) lintab) lin16u_gen: { .label _5 = 5 .label ampl = 3 @@ -3961,6 +3972,7 @@ lin16u_gen: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(3) dividend, word zeropage($d) divisor, word zeropage($f) rem) divr16u: { .label rem = $f .label dividend = 3 @@ -4852,6 +4864,7 @@ print_ln: { } //SEG172 print_word // Print a word as HEX +// print_word(word zeropage(5) w) print_word: { .label w = 5 //SEG173 [67] (byte) print_byte::b#0 ← > (word) print_word::w#10 -- vbuxx=_hi_vwuz1 @@ -4877,6 +4890,7 @@ print_word: { } //SEG186 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG187 [73] (byte~) print_byte::$0 ← (byte) print_byte::b#3 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -4910,6 +4924,7 @@ print_byte: { } //SEG202 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG203 [81] *((byte*) print_char_cursor#50) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa ldy #0 @@ -4925,6 +4940,7 @@ print_char: { } //SEG207 print_str // Print a zero-terminated string +// print_str(byte* zeropage(5) str) print_str: { .label str = 5 //SEG208 [85] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -4996,6 +5012,7 @@ print_cls: { // Generate word linear table // lintab - the table to generate into // length - the number of points in a total sinus wavelength (the size of the table) +// lin16u_gen(word zeropage(5) min, word zeropage(3) max, word* zeropage(7) lintab) lin16u_gen: { .label _5 = 5 .label ampl = 3 @@ -5140,6 +5157,7 @@ lin16u_gen: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(3) dividend, word zeropage($d) divisor, word zeropage($f) rem) divr16u: { .label rem = $f .label dividend = 3 diff --git a/src/test/ref/loopnest3.asm b/src/test/ref/loopnest3.asm index 5db383893..68ef0081d 100644 --- a/src/test/ref/loopnest3.asm +++ b/src/test/ref/loopnest3.asm @@ -11,11 +11,13 @@ main: { bne b1 rts } +// b(byte register(Y) i) b: { tya jsr c rts } +// c(byte register(A) i) c: { ldx #0 b1: diff --git a/src/test/ref/loopnest3.log b/src/test/ref/loopnest3.log index 720a5797a..7c97d8d6a 100644 --- a/src/test/ref/loopnest3.log +++ b/src/test/ref/loopnest3.log @@ -281,6 +281,7 @@ main: { rts } //SEG23 b +// b(byte zeropage(4) i) b: { .label i = 4 //SEG24 [11] (byte) c::i#0 ← (byte) b::i#0 -- vbuz1=vbuz2 @@ -297,6 +298,7 @@ b: { rts } //SEG29 c +// c(byte zeropage(5) i) c: { .label i = 5 .label j = 3 @@ -401,6 +403,7 @@ main: { rts } //SEG23 b +// b(byte register(Y) i) b: { //SEG24 [11] (byte) c::i#0 ← (byte) b::i#0 -- vbuaa=vbuyy tya @@ -415,6 +418,7 @@ b: { rts } //SEG29 c +// c(byte register(A) i) c: { //SEG30 [15] phi from c to c::@1 [phi:c->c::@1] b1_from_c: @@ -550,6 +554,7 @@ main: { rts } //SEG23 b +// b(byte register(Y) i) b: { //SEG24 [11] (byte) c::i#0 ← (byte) b::i#0 -- vbuaa=vbuyy tya @@ -561,6 +566,7 @@ b: { rts } //SEG29 c +// c(byte register(A) i) c: { //SEG30 [15] phi from c to c::@1 [phi:c->c::@1] //SEG31 [15] phi (byte) c::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:c->c::@1#0] -- vbuxx=vbuc1 diff --git a/src/test/ref/min-fmul-16.asm b/src/test/ref/min-fmul-16.asm index 6e962b60e..9cd0ecb72 100644 --- a/src/test/ref/min-fmul-16.asm +++ b/src/test/ref/min-fmul-16.asm @@ -35,6 +35,7 @@ print_set_screen: { rts } // Print a dword as HEX +// print_dword(dword zeropage(9) dw) print_dword: { .label dw = 9 lda dw+2 @@ -50,6 +51,7 @@ print_dword: { rts } // Print a word as HEX +// print_word(word zeropage(2) w) print_word: { .label w = 2 lda w+1 @@ -61,6 +63,7 @@ print_word: { rts } // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { txa lsr @@ -78,6 +81,7 @@ print_byte: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y diff --git a/src/test/ref/min-fmul-16.log b/src/test/ref/min-fmul-16.log index 9306b1759..b7a19d223 100644 --- a/src/test/ref/min-fmul-16.log +++ b/src/test/ref/min-fmul-16.log @@ -1461,6 +1461,7 @@ print_set_screen: { } //SEG38 print_dword // Print a dword as HEX +// print_dword(dword zeropage($1e) dw) print_dword: { .label dw = $1e //SEG39 [20] (word) print_word::w#0 ← > (dword) print_dword::dw#0 -- vwuz1=_hi_vduz2 @@ -1496,6 +1497,7 @@ print_dword: { } //SEG52 print_word // Print a word as HEX +// print_word(word zeropage(2) w) print_word: { .label w = 2 //SEG53 [26] (byte) print_byte::b#0 ← > (word) print_word::w#2 -- vbuz1=_hi_vwuz2 @@ -1527,6 +1529,7 @@ print_word: { } //SEG66 print_byte // Print a byte as HEX +// print_byte(byte zeropage(4) b) print_byte: { .label _0 = $22 .label _2 = $23 @@ -1573,6 +1576,7 @@ print_byte: { } //SEG82 print_char // Print a single char +// print_char(byte zeropage(5) ch) print_char: { .label ch = 5 //SEG83 [40] *((byte*) print_char_cursor#27) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuz2 @@ -2179,6 +2183,7 @@ print_set_screen: { } //SEG38 print_dword // Print a dword as HEX +// print_dword(dword zeropage(9) dw) print_dword: { .label dw = 9 //SEG39 [20] (word) print_word::w#0 ← > (dword) print_dword::dw#0 -- vwuz1=_hi_vduz2 @@ -2214,6 +2219,7 @@ print_dword: { } //SEG52 print_word // Print a word as HEX +// print_word(word zeropage(2) w) print_word: { .label w = 2 //SEG53 [26] (byte) print_byte::b#0 ← > (word) print_word::w#2 -- vbuxx=_hi_vwuz1 @@ -2245,6 +2251,7 @@ print_word: { } //SEG66 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG67 [32] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -2284,6 +2291,7 @@ print_byte: { } //SEG82 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG83 [40] *((byte*) print_char_cursor#27) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa ldy #0 @@ -2956,6 +2964,7 @@ print_set_screen: { } //SEG38 print_dword // Print a dword as HEX +// print_dword(dword zeropage(9) dw) print_dword: { .label dw = 9 //SEG39 [20] (word) print_word::w#0 ← > (dword) print_dword::dw#0 -- vwuz1=_hi_vduz2 @@ -2985,6 +2994,7 @@ print_dword: { } //SEG52 print_word // Print a word as HEX +// print_word(word zeropage(2) w) print_word: { .label w = 2 //SEG53 [26] (byte) print_byte::b#0 ← > (word) print_word::w#2 -- vbuxx=_hi_vwuz1 @@ -3010,6 +3020,7 @@ print_word: { } //SEG66 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG67 [32] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -3043,6 +3054,7 @@ print_byte: { } //SEG82 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG83 [40] *((byte*) print_char_cursor#27) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa ldy #0 diff --git a/src/test/ref/norom-charset.asm b/src/test/ref/norom-charset.asm index 269e24864..b3eef72dd 100644 --- a/src/test/ref/norom-charset.asm +++ b/src/test/ref/norom-charset.asm @@ -40,6 +40,7 @@ main: { } // Generate one 5x3 character from a 16-bit char spec // The 5x3 char is stored as 5x 3-bit rows followed by a zero. %aaabbbcc cdddeee0 +// gen_char3(byte* zeropage(2) dst, word zeropage(6) spec) gen_char3: { .label dst = 2 .label spec = 6 diff --git a/src/test/ref/norom-charset.log b/src/test/ref/norom-charset.log index 515e6a41b..b4b76d4ac 100644 --- a/src/test/ref/norom-charset.log +++ b/src/test/ref/norom-charset.log @@ -593,6 +593,7 @@ main: { //SEG30 gen_char3 // Generate one 5x3 character from a 16-bit char spec // The 5x3 char is stored as 5x 3-bit rows followed by a zero. %aaabbbcc cdddeee0 +// gen_char3(byte* zeropage($a) dst, word zeropage(6) spec) gen_char3: { .label _0 = $c .label _1 = $d @@ -833,6 +834,7 @@ main: { //SEG30 gen_char3 // Generate one 5x3 character from a 16-bit char spec // The 5x3 char is stored as 5x 3-bit rows followed by a zero. %aaabbbcc cdddeee0 +// gen_char3(byte* zeropage(2) dst, word zeropage(6) spec) gen_char3: { .label dst = 2 .label spec = 6 @@ -1112,6 +1114,7 @@ main: { //SEG30 gen_char3 // Generate one 5x3 character from a 16-bit char spec // The 5x3 char is stored as 5x 3-bit rows followed by a zero. %aaabbbcc cdddeee0 +// gen_char3(byte* zeropage(2) dst, word zeropage(6) spec) gen_char3: { .label dst = 2 .label spec = 6 diff --git a/src/test/ref/overlap-allocation-2.asm b/src/test/ref/overlap-allocation-2.asm index 0b1a3aa27..21a9d7ed8 100644 --- a/src/test/ref/overlap-allocation-2.asm +++ b/src/test/ref/overlap-allocation-2.asm @@ -18,6 +18,7 @@ main: { bne b2 rts } +// line(byte register(X) l) line: { txa jsr plot @@ -27,6 +28,7 @@ line: { jsr plot rts } +// plot(byte register(A) x) plot: { tay lda #'*' diff --git a/src/test/ref/overlap-allocation-2.log b/src/test/ref/overlap-allocation-2.log index 6d307834b..f09a1d64a 100644 --- a/src/test/ref/overlap-allocation-2.log +++ b/src/test/ref/overlap-allocation-2.log @@ -377,6 +377,7 @@ main: { rts } //SEG37 line +// line(byte zeropage(4) l) line: { .label l = 4 //SEG38 [17] (byte) plot::x#0 ← (byte) line::l#2 -- vbuz1=vbuz2 @@ -407,6 +408,7 @@ line: { rts } //SEG49 plot +// plot(byte zeropage(5) x) plot: { .label x = 5 //SEG50 [23] *((const byte*) SCREEN#0 + (byte) plot::x#2) ← (byte) '*' -- pbuc1_derefidx_vbuz1=vbuc2 @@ -528,6 +530,7 @@ main: { rts } //SEG37 line +// line(byte register(X) l) line: { //SEG38 [17] (byte) plot::x#0 ← (byte) line::l#2 -- vbuaa=vbuxx txa @@ -555,6 +558,7 @@ line: { rts } //SEG49 plot +// plot(byte register(A) x) plot: { //SEG50 [23] *((const byte*) SCREEN#0 + (byte) plot::x#2) ← (byte) '*' -- pbuc1_derefidx_vbuaa=vbuc2 tay @@ -710,6 +714,7 @@ main: { rts } //SEG37 line +// line(byte register(X) l) line: { //SEG38 [17] (byte) plot::x#0 ← (byte) line::l#2 -- vbuaa=vbuxx txa @@ -731,6 +736,7 @@ line: { rts } //SEG49 plot +// plot(byte register(A) x) plot: { //SEG50 [23] *((const byte*) SCREEN#0 + (byte) plot::x#2) ← (byte) '*' -- pbuc1_derefidx_vbuaa=vbuc2 tay diff --git a/src/test/ref/overlap-allocation.asm b/src/test/ref/overlap-allocation.asm index b64b90837..cde9d9239 100644 --- a/src/test/ref/overlap-allocation.asm +++ b/src/test/ref/overlap-allocation.asm @@ -25,6 +25,7 @@ main: { bne b3 rts } +// plot(byte register(X) x) plot: { lda #'*' sta SCREEN,x diff --git a/src/test/ref/overlap-allocation.log b/src/test/ref/overlap-allocation.log index 9297fed3a..b67422622 100644 --- a/src/test/ref/overlap-allocation.log +++ b/src/test/ref/overlap-allocation.log @@ -411,6 +411,7 @@ main: { rts } //SEG49 plot +// plot(byte zeropage(5) x) plot: { .label x = 5 //SEG50 [22] *((const byte*) SCREEN#0 + (byte) plot::x#3) ← (byte) '*' -- pbuc1_derefidx_vbuz1=vbuc2 @@ -554,6 +555,7 @@ main: { rts } //SEG49 plot +// plot(byte register(X) x) plot: { //SEG50 [22] *((const byte*) SCREEN#0 + (byte) plot::x#3) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2 lda #'*' @@ -728,6 +730,7 @@ main: { rts } //SEG49 plot +// plot(byte register(X) x) plot: { //SEG50 [22] *((const byte*) SCREEN#0 + (byte) plot::x#3) ← (byte) '*' -- pbuc1_derefidx_vbuxx=vbuc2 lda #'*' diff --git a/src/test/ref/printmsg.asm b/src/test/ref/printmsg.asm index eaec7cd8f..529a83180 100644 --- a/src/test/ref/printmsg.asm +++ b/src/test/ref/printmsg.asm @@ -61,6 +61,7 @@ print_ln: { rts } // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 b1: diff --git a/src/test/ref/printmsg.log b/src/test/ref/printmsg.log index 5a0962429..e5d043fcd 100644 --- a/src/test/ref/printmsg.log +++ b/src/test/ref/printmsg.log @@ -590,6 +590,7 @@ print_ln: { } //SEG52 print_str // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 //SEG53 [23] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -807,6 +808,7 @@ print_ln: { } //SEG52 print_str // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 //SEG53 [23] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -1068,6 +1070,7 @@ print_ln: { } //SEG52 print_str // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 //SEG53 [23] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] diff --git a/src/test/ref/roll-sprite-msb.asm b/src/test/ref/roll-sprite-msb.asm index ed8a6a710..4f1c25c04 100644 --- a/src/test/ref/roll-sprite-msb.asm +++ b/src/test/ref/roll-sprite-msb.asm @@ -27,6 +27,7 @@ main: { bne b1 rts } +// position_sprite(byte zeropage(4) spriteno, word zeropage(2) x) position_sprite: { .const y = $32 .label spriteno = 4 diff --git a/src/test/ref/roll-sprite-msb.log b/src/test/ref/roll-sprite-msb.log index 80a9350c2..ab39c29f6 100644 --- a/src/test/ref/roll-sprite-msb.log +++ b/src/test/ref/roll-sprite-msb.log @@ -728,6 +728,7 @@ main: { rts } //SEG27 position_sprite +// position_sprite(byte zeropage(5) spriteno, word zeropage(6) x) position_sprite: { .const y = $32 .label _0 = 8 @@ -945,6 +946,7 @@ main: { rts } //SEG27 position_sprite +// position_sprite(byte zeropage(4) spriteno, word zeropage(2) x) position_sprite: { .const y = $32 .label spriteno = 4 @@ -1227,6 +1229,7 @@ main: { rts } //SEG27 position_sprite +// position_sprite(byte zeropage(4) spriteno, word zeropage(2) x) position_sprite: { .const y = $32 .label spriteno = 4 diff --git a/src/test/ref/scan-desire-problem.asm b/src/test/ref/scan-desire-problem.asm index 912afcc2f..2ffd658d0 100644 --- a/src/test/ref/scan-desire-problem.asm +++ b/src/test/ref/scan-desire-problem.asm @@ -55,6 +55,7 @@ main: { b3: jmp b3 } +// draw_block(byte register(A) tileno, byte register(Y) x, byte register(X) y) draw_block: { .label tileno = 8 .label x1 = 9 @@ -166,6 +167,7 @@ draw_block: { rts } // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a) mul8u: { .const b = $28 .label mb = 6 @@ -233,6 +235,7 @@ init: { rts } // Fill some memory with a value +// fill(byte register(X) val) fill: { .label end = 6 .label addr = 4 diff --git a/src/test/ref/scan-desire-problem.log b/src/test/ref/scan-desire-problem.log index 4de39e0c7..e2d61a913 100644 --- a/src/test/ref/scan-desire-problem.log +++ b/src/test/ref/scan-desire-problem.log @@ -1808,6 +1808,7 @@ main: { jmp b3_from_b3 } //SEG37 draw_block +// draw_block(byte zeropage($e) tileno, byte zeropage($f) x, byte zeropage($10) y) draw_block: { .label _1 = $12 .label tileno = $e @@ -1968,6 +1969,7 @@ draw_block: { } //SEG60 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte zeropage(4) a) mul8u: { .const b = $28 .label _1 = $1d @@ -2116,6 +2118,7 @@ init: { } //SEG109 fill // Fill some memory with a value +// fill(byte zeropage(9) val) fill: { .label end = $1e .label addr = $a @@ -2444,6 +2447,7 @@ main: { jmp b3_from_b3 } //SEG37 draw_block +// draw_block(byte register(A) tileno, byte register(Y) x, byte register(X) y) draw_block: { .label tileno = 8 .label x1 = 9 @@ -2583,6 +2587,7 @@ draw_block: { } //SEG60 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a) mul8u: { .const b = $28 .label mb = 6 @@ -2726,6 +2731,7 @@ init: { } //SEG109 fill // Fill some memory with a value +// fill(byte register(X) val) fill: { .label end = 6 .label addr = 4 @@ -3273,6 +3279,7 @@ main: { jmp b3 } //SEG37 draw_block +// draw_block(byte register(A) tileno, byte register(Y) x, byte register(X) y) draw_block: { .label tileno = 8 .label x1 = 9 @@ -3407,6 +3414,7 @@ draw_block: { } //SEG60 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a) mul8u: { .const b = $28 .label mb = 6 @@ -3523,6 +3531,7 @@ init: { } //SEG109 fill // Fill some memory with a value +// fill(byte register(X) val) fill: { .label end = 6 .label addr = 4 diff --git a/src/test/ref/sinus-basic.asm b/src/test/ref/sinus-basic.asm index 04d9d8d13..e88a20d3c 100644 --- a/src/test/ref/sinus-basic.asm +++ b/src/test/ref/sinus-basic.asm @@ -97,6 +97,7 @@ print_ln: { rts } // Print a word as HEX +// print_word(word zeropage(7) w) print_word: { .label w = 7 lda w+1 @@ -108,6 +109,7 @@ print_word: { rts } // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { txa lsr @@ -125,6 +127,7 @@ print_byte: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -164,6 +167,7 @@ addMEMtoFAC: { rts } // Prepare MEM pointers for operations using MEM +// prepareMEM(byte* zeropage(7) mem) prepareMEM: { .label mem = 7 lda mem @@ -175,6 +179,7 @@ prepareMEM: { // FAC = MEM*FAC // Set FAC to MEM (float saved in memory) multiplied by FAC (float accumulator) // Reads 5 bytes from memory +// mulFACbyMEM(byte* zeropage(7) mem) mulFACbyMEM: { .label mem = 7 jsr prepareMEM @@ -206,6 +211,7 @@ divMEMbyFAC: { } // FAC = word // Set the FAC (floating point accumulator) to the integer value of a 16bit word +// setFAC(word zeropage(7) w) setFAC: { .label w = 7 jsr prepareMEM @@ -218,6 +224,7 @@ setFAC: { // MEM = FAC // Stores the value of the FAC to memory // Stores 5 bytes (means it is necessary to allocate 5 bytes to avoid clobbering other data using eg. byte[] mem = {0, 0, 0, 0, 0};) +// setMEMtoFAC(byte* zeropage(7) mem) setMEMtoFAC: { .label mem = 7 jsr prepareMEM diff --git a/src/test/ref/sinus-basic.log b/src/test/ref/sinus-basic.log index 74df75c55..373589065 100644 --- a/src/test/ref/sinus-basic.log +++ b/src/test/ref/sinus-basic.log @@ -1329,6 +1329,7 @@ print_ln: { } //SEG92 print_word // Print a word as HEX +// print_word(word zeropage($13) w) print_word: { .label w = $13 //SEG93 [43] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuz1=_hi_vwuz2 @@ -1360,6 +1361,7 @@ print_word: { } //SEG106 print_byte // Print a byte as HEX +// print_byte(byte zeropage(5) b) print_byte: { .label _0 = $15 .label _2 = $16 @@ -1406,6 +1408,7 @@ print_byte: { } //SEG122 print_char // Print a single char +// print_char(byte zeropage(6) ch) print_char: { .label ch = 6 //SEG123 [57] *((byte*) print_char_cursor#23) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuz2 @@ -1475,6 +1478,7 @@ addMEMtoFAC: { } //SEG140 prepareMEM // Prepare MEM pointers for operations using MEM +// prepareMEM(byte* zeropage(9) mem) prepareMEM: { .label _0 = $19 .label _1 = $1a @@ -1501,6 +1505,7 @@ prepareMEM: { // FAC = MEM*FAC // Set FAC to MEM (float saved in memory) multiplied by FAC (float accumulator) // Reads 5 bytes from memory +// mulFACbyMEM(byte* zeropage($b) mem) mulFACbyMEM: { .label mem = $b //SEG148 [74] (byte*) prepareMEM::mem#4 ← (byte*) mulFACbyMEM::mem#2 -- pbuz1=pbuz2 @@ -1569,6 +1574,7 @@ divMEMbyFAC: { //SEG168 setFAC // FAC = word // Set the FAC (floating point accumulator) to the integer value of a 16bit word +// setFAC(word zeropage($d) w) setFAC: { .label w = $d //SEG169 [85] (byte*~) prepareMEM::mem#7 ← (byte*)(word) setFAC::w#3 -- pbuz1=pbuz2 @@ -1599,6 +1605,7 @@ setFAC: { // MEM = FAC // Stores the value of the FAC to memory // Stores 5 bytes (means it is necessary to allocate 5 bytes to avoid clobbering other data using eg. byte[] mem = {0, 0, 0, 0, 0};) +// setMEMtoFAC(byte* zeropage($f) mem) setMEMtoFAC: { .label mem = $f //SEG178 [90] (byte*) prepareMEM::mem#1 ← (byte*) setMEMtoFAC::mem#2 -- pbuz1=pbuz2 @@ -2004,6 +2011,7 @@ print_ln: { } //SEG92 print_word // Print a word as HEX +// print_word(word zeropage(7) w) print_word: { .label w = 7 //SEG93 [43] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuxx=_hi_vwuz1 @@ -2035,6 +2043,7 @@ print_word: { } //SEG106 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG107 [49] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -2074,6 +2083,7 @@ print_byte: { } //SEG122 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG123 [57] *((byte*) print_char_cursor#23) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa ldy #0 @@ -2140,6 +2150,7 @@ addMEMtoFAC: { } //SEG140 prepareMEM // Prepare MEM pointers for operations using MEM +// prepareMEM(byte* zeropage(7) mem) prepareMEM: { .label mem = 7 //SEG141 [68] (byte~) prepareMEM::$0 ← < (byte*) prepareMEM::mem#5 -- vbuaa=_lo_pbuz1 @@ -2160,6 +2171,7 @@ prepareMEM: { // FAC = MEM*FAC // Set FAC to MEM (float saved in memory) multiplied by FAC (float accumulator) // Reads 5 bytes from memory +// mulFACbyMEM(byte* zeropage(7) mem) mulFACbyMEM: { .label mem = 7 //SEG148 [74] (byte*) prepareMEM::mem#4 ← (byte*) mulFACbyMEM::mem#2 @@ -2224,6 +2236,7 @@ divMEMbyFAC: { //SEG168 setFAC // FAC = word // Set the FAC (floating point accumulator) to the integer value of a 16bit word +// setFAC(word zeropage(7) w) setFAC: { .label w = 7 //SEG169 [85] (byte*~) prepareMEM::mem#7 ← (byte*)(word) setFAC::w#3 @@ -2250,6 +2263,7 @@ setFAC: { // MEM = FAC // Stores the value of the FAC to memory // Stores 5 bytes (means it is necessary to allocate 5 bytes to avoid clobbering other data using eg. byte[] mem = {0, 0, 0, 0, 0};) +// setMEMtoFAC(byte* zeropage(7) mem) setMEMtoFAC: { .label mem = 7 //SEG178 [90] (byte*) prepareMEM::mem#1 ← (byte*) setMEMtoFAC::mem#2 @@ -2729,6 +2743,7 @@ print_ln: { } //SEG92 print_word // Print a word as HEX +// print_word(word zeropage(7) w) print_word: { .label w = 7 //SEG93 [43] (byte) print_byte::b#0 ← > (word) print_word::w#0 -- vbuxx=_hi_vwuz1 @@ -2754,6 +2769,7 @@ print_word: { } //SEG106 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG107 [49] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -2787,6 +2803,7 @@ print_byte: { } //SEG122 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG123 [57] *((byte*) print_char_cursor#23) ← (byte) print_char::ch#2 -- _deref_pbuz1=vbuaa ldy #0 @@ -2844,6 +2861,7 @@ addMEMtoFAC: { } //SEG140 prepareMEM // Prepare MEM pointers for operations using MEM +// prepareMEM(byte* zeropage(7) mem) prepareMEM: { .label mem = 7 //SEG141 [68] (byte~) prepareMEM::$0 ← < (byte*) prepareMEM::mem#5 -- vbuaa=_lo_pbuz1 @@ -2862,6 +2880,7 @@ prepareMEM: { // FAC = MEM*FAC // Set FAC to MEM (float saved in memory) multiplied by FAC (float accumulator) // Reads 5 bytes from memory +// mulFACbyMEM(byte* zeropage(7) mem) mulFACbyMEM: { .label mem = 7 //SEG148 [74] (byte*) prepareMEM::mem#4 ← (byte*) mulFACbyMEM::mem#2 @@ -2914,6 +2933,7 @@ divMEMbyFAC: { //SEG168 setFAC // FAC = word // Set the FAC (floating point accumulator) to the integer value of a 16bit word +// setFAC(word zeropage(7) w) setFAC: { .label w = 7 //SEG169 [85] (byte*~) prepareMEM::mem#7 ← (byte*)(word) setFAC::w#3 @@ -2935,6 +2955,7 @@ setFAC: { // MEM = FAC // Stores the value of the FAC to memory // Stores 5 bytes (means it is necessary to allocate 5 bytes to avoid clobbering other data using eg. byte[] mem = {0, 0, 0, 0, 0};) +// setMEMtoFAC(byte* zeropage(7) mem) setMEMtoFAC: { .label mem = 7 //SEG178 [90] (byte*) prepareMEM::mem#1 ← (byte*) setMEMtoFAC::mem#2 diff --git a/src/test/ref/sinusgen16.asm b/src/test/ref/sinusgen16.asm index 358153bca..6123f0c40 100644 --- a/src/test/ref/sinusgen16.asm +++ b/src/test/ref/sinusgen16.asm @@ -66,6 +66,7 @@ main: { sintab1: .fill 2*$78, 0 } // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 b1: @@ -89,6 +90,7 @@ print_str: { jmp b1 } // Print a signed word as HEX +// print_sword(signed word zeropage(6) w) print_sword: { .label w = 6 lda w+1 @@ -119,6 +121,7 @@ print_word: { rts } // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { txa lsr @@ -136,6 +139,7 @@ print_byte: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -171,6 +175,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage(2) sintab) sin16s_gen: { .label _1 = 6 .label step = $1b @@ -244,6 +249,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($f) x) sin16s: { .label _6 = $f .label x = $f @@ -419,6 +425,7 @@ sin16s: { } // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage(8) v1, word zeropage($13) v2, byte register(X) select) mulu16_sel: { .label _0 = $f .label _1 = $f @@ -449,6 +456,7 @@ mulu16_sel: { rts } // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($15) a, word zeropage($13) b) mul16u: { .label mb = $17 .label a = $15 @@ -537,6 +545,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 diff --git a/src/test/ref/sinusgen16.log b/src/test/ref/sinusgen16.log index eedf2fad1..a9d9c92cd 100644 --- a/src/test/ref/sinusgen16.log +++ b/src/test/ref/sinusgen16.log @@ -2561,6 +2561,7 @@ main: { } //SEG48 print_str // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 //SEG49 [22] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -2602,6 +2603,7 @@ print_str: { } //SEG60 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(6) w) print_sword: { .label w = 6 //SEG61 [28] if((signed word) print_sword::w#1>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -2681,6 +2683,7 @@ print_word: { } //SEG91 print_byte // Print a byte as HEX +// print_byte(byte zeropage(8) b) print_byte: { .label _0 = $35 .label _2 = $36 @@ -2727,6 +2730,7 @@ print_byte: { } //SEG107 print_char // Print a single char +// print_char(byte zeropage(9) ch) print_char: { .label ch = 9 //SEG108 [49] *((byte*) print_char_cursor#33) ← (byte) print_char::ch#3 -- _deref_pbuz1=vbuz2 @@ -2788,6 +2792,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage($12) sintab) sin16s_gen: { .label _1 = $41 .label step = $3b @@ -2925,6 +2930,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($17) x) sin16s: { .label _6 = $43 .label x = $17 @@ -3282,6 +3288,7 @@ sin16s: { //SEG231 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($1d) v1, word zeropage($1f) v2, byte zeropage($21) select) mulu16_sel: { .label _0 = $69 .label _1 = $6d @@ -3359,6 +3366,7 @@ mulu16_sel: { } //SEG242 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($22) a, word zeropage($63) b) mul16u: { .label _1 = $73 .label mb = $28 @@ -3531,6 +3539,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage($2e) dividend, word zeropage($2c) rem) divr16u: { .label _1 = $80 .label _2 = $81 @@ -4105,6 +4114,7 @@ main: { } //SEG48 print_str // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 //SEG49 [22] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -4146,6 +4156,7 @@ print_str: { } //SEG60 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(6) w) print_sword: { .label w = 6 //SEG61 [28] if((signed word) print_sword::w#1>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -4224,6 +4235,7 @@ print_word: { } //SEG91 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG92 [41] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -4263,6 +4275,7 @@ print_byte: { } //SEG107 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG108 [49] *((byte*) print_char_cursor#33) ← (byte) print_char::ch#3 -- _deref_pbuz1=vbuaa ldy #0 @@ -4322,6 +4335,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage(2) sintab) sin16s_gen: { .label _1 = 6 .label step = $1b @@ -4435,6 +4449,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($f) x) sin16s: { .label _6 = $f .label x = $f @@ -4724,6 +4739,7 @@ sin16s: { //SEG231 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage(8) v1, word zeropage($13) v2, byte register(X) select) mulu16_sel: { .label _0 = $f .label _1 = $f @@ -4769,6 +4785,7 @@ mulu16_sel: { } //SEG242 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($15) a, word zeropage($13) b) mul16u: { .label mb = $17 .label a = $15 @@ -4921,6 +4938,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 @@ -5625,6 +5643,7 @@ main: { } //SEG48 print_str // Print a zero-terminated string +// print_str(byte* zeropage(4) str) print_str: { .label str = 4 //SEG49 [22] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -5660,6 +5679,7 @@ print_str: { } //SEG60 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(6) w) print_sword: { .label w = 6 //SEG61 [28] if((signed word) print_sword::w#1>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -5721,6 +5741,7 @@ print_word: { } //SEG91 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG92 [41] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -5754,6 +5775,7 @@ print_byte: { } //SEG107 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG108 [49] *((byte*) print_char_cursor#33) ← (byte) print_char::ch#3 -- _deref_pbuz1=vbuaa ldy #0 @@ -5805,6 +5827,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage(2) sintab) sin16s_gen: { .label _1 = 6 .label step = $1b @@ -5905,6 +5928,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($f) x) sin16s: { .label _6 = $f .label x = $f @@ -6161,6 +6185,7 @@ sin16s: { //SEG231 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage(8) v1, word zeropage($13) v2, byte register(X) select) mulu16_sel: { .label _0 = $f .label _1 = $f @@ -6202,6 +6227,7 @@ mulu16_sel: { } //SEG242 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($15) a, word zeropage($13) b) mul16u: { .label mb = $17 .label a = $15 @@ -6333,6 +6359,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 diff --git a/src/test/ref/sinusgen16b.asm b/src/test/ref/sinusgen16b.asm index 7e9992489..76f9d7c1e 100644 --- a/src/test/ref/sinusgen16b.asm +++ b/src/test/ref/sinusgen16b.asm @@ -83,6 +83,7 @@ main: { sintab2: .fill 2*$78, 0 } // Print a zero-terminated string +// print_str(byte* zeropage(6) str) print_str: { .label str = 6 b1: @@ -106,6 +107,7 @@ print_str: { jmp b1 } // Print a signed word as HEX +// print_sword(signed word zeropage(8) w) print_sword: { .label w = 8 lda w+1 @@ -136,6 +138,7 @@ print_word: { rts } // Print a byte as HEX +// print_byte(byte zeropage($a) b) print_byte: { .label b = $a lda b @@ -154,6 +157,7 @@ print_byte: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -189,6 +193,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_genb(signed word* zeropage(2) sintab) sin16s_genb: { .label _2 = 8 .label step = $1d @@ -258,6 +263,7 @@ sin16s_genb: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16sb(word zeropage(6) x) sin16sb: { .label x = 6 .label return = 8 @@ -398,6 +404,7 @@ sin16sb: { } // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($b) v1, word zeropage($11) v2, byte register(X) select) mulu16_sel: { .label _0 = $15 .label _1 = $15 @@ -432,6 +439,7 @@ mulu16_sel: { rts } // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($13) a, word zeropage($11) b) mul16u: { .label mb = $19 .label a = $13 @@ -520,6 +528,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 @@ -572,6 +581,7 @@ divr16u: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage(2) sintab) sin16s_gen: { .label _1 = 6 .label step = $1d @@ -645,6 +655,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($15) x) sin16s: { .label _6 = $15 .label x = $15 diff --git a/src/test/ref/sinusgen16b.log b/src/test/ref/sinusgen16b.log index e8cce4e61..4475cecf5 100644 --- a/src/test/ref/sinusgen16b.log +++ b/src/test/ref/sinusgen16b.log @@ -3367,6 +3367,7 @@ main: { } //SEG58 print_str // Print a zero-terminated string +// print_str(byte* zeropage(7) str) print_str: { .label str = 7 //SEG59 [26] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -3408,6 +3409,7 @@ print_str: { } //SEG70 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(9) w) print_sword: { .label w = 9 //SEG71 [32] if((signed word) print_sword::w#1>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -3487,6 +3489,7 @@ print_word: { } //SEG101 print_byte // Print a byte as HEX +// print_byte(byte zeropage($b) b) print_byte: { .label _0 = $45 .label _2 = $46 @@ -3533,6 +3536,7 @@ print_byte: { } //SEG117 print_char // Print a single char +// print_char(byte zeropage($c) ch) print_char: { .label ch = $c //SEG118 [53] *((byte*) print_char_cursor#33) ← (byte) print_char::ch#3 -- _deref_pbuz1=vbuz2 @@ -3594,6 +3598,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_genb(signed word* zeropage($15) sintab) sin16s_genb: { .label _2 = $51 .label step = $4b @@ -3727,6 +3732,7 @@ sin16s_genb: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16sb(word zeropage($1a) x) sin16sb: { .label x = $1a .label return = $4f @@ -4044,6 +4050,7 @@ sin16sb: { //SEG240 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($1e) v1, word zeropage($20) v2, byte zeropage($22) select) mulu16_sel: { .label _0 = $75 .label _1 = $79 @@ -4126,6 +4133,7 @@ mulu16_sel: { } //SEG251 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($23) a, word zeropage($6f) b) mul16u: { .label _1 = $7f .label mb = $29 @@ -4299,6 +4307,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage($2f) dividend, word zeropage($2d) rem) divr16u: { .label _1 = $8c .label _2 = $8d @@ -4422,6 +4431,7 @@ divr16u: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage($38) sintab) sin16s_gen: { .label _1 = $9a .label step = $94 @@ -4559,6 +4569,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($3d) x) sin16s: { .label _6 = $9c .label x = $3d @@ -5540,6 +5551,7 @@ main: { } //SEG58 print_str // Print a zero-terminated string +// print_str(byte* zeropage(6) str) print_str: { .label str = 6 //SEG59 [26] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -5581,6 +5593,7 @@ print_str: { } //SEG70 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(8) w) print_sword: { .label w = 8 //SEG71 [32] if((signed word) print_sword::w#1>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -5659,6 +5672,7 @@ print_word: { } //SEG101 print_byte // Print a byte as HEX +// print_byte(byte zeropage($a) b) print_byte: { .label b = $a //SEG102 [45] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4 @@ -5699,6 +5713,7 @@ print_byte: { } //SEG117 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG118 [53] *((byte*) print_char_cursor#33) ← (byte) print_char::ch#3 -- _deref_pbuz1=vbuaa ldy #0 @@ -5758,6 +5773,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_genb(signed word* zeropage(2) sintab) sin16s_genb: { .label _2 = 8 .label step = $1d @@ -5867,6 +5883,7 @@ sin16s_genb: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16sb(word zeropage(6) x) sin16sb: { .label x = 6 .label return = 8 @@ -6120,6 +6137,7 @@ sin16sb: { //SEG240 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($b) v1, word zeropage($11) v2, byte register(X) select) mulu16_sel: { .label _0 = $15 .label _1 = $15 @@ -6169,6 +6187,7 @@ mulu16_sel: { } //SEG251 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($13) a, word zeropage($11) b) mul16u: { .label mb = $19 .label a = $13 @@ -6321,6 +6340,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 @@ -6429,6 +6449,7 @@ divr16u: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage(2) sintab) sin16s_gen: { .label _1 = 6 .label step = $1d @@ -6542,6 +6563,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($15) x) sin16s: { .label _6 = $15 .label x = $15 @@ -7600,6 +7622,7 @@ main: { } //SEG58 print_str // Print a zero-terminated string +// print_str(byte* zeropage(6) str) print_str: { .label str = 6 //SEG59 [26] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -7635,6 +7658,7 @@ print_str: { } //SEG70 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(8) w) print_sword: { .label w = 8 //SEG71 [32] if((signed word) print_sword::w#1>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -7696,6 +7720,7 @@ print_word: { } //SEG101 print_byte // Print a byte as HEX +// print_byte(byte zeropage($a) b) print_byte: { .label b = $a //SEG102 [45] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4 @@ -7730,6 +7755,7 @@ print_byte: { } //SEG117 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG118 [53] *((byte*) print_char_cursor#33) ← (byte) print_char::ch#3 -- _deref_pbuz1=vbuaa ldy #0 @@ -7781,6 +7807,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_genb(signed word* zeropage(2) sintab) sin16s_genb: { .label _2 = 8 .label step = $1d @@ -7877,6 +7904,7 @@ sin16s_genb: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16sb(word zeropage(6) x) sin16sb: { .label x = 6 .label return = 8 @@ -8097,6 +8125,7 @@ sin16sb: { //SEG240 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($b) v1, word zeropage($11) v2, byte register(X) select) mulu16_sel: { .label _0 = $15 .label _1 = $15 @@ -8142,6 +8171,7 @@ mulu16_sel: { } //SEG251 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($13) a, word zeropage($11) b) mul16u: { .label mb = $19 .label a = $13 @@ -8273,6 +8303,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 @@ -8362,6 +8393,7 @@ divr16u: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage(2) sintab) sin16s_gen: { .label _1 = 6 .label step = $1d @@ -8462,6 +8494,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($15) x) sin16s: { .label _6 = $15 .label x = $15 diff --git a/src/test/ref/sinusgen8.asm b/src/test/ref/sinusgen8.asm index 85b48e296..09a7034d9 100644 --- a/src/test/ref/sinusgen8.asm +++ b/src/test/ref/sinusgen8.asm @@ -49,6 +49,7 @@ main: { sintabref: .byte 0, 4, 8, $c, $11, $15, $19, $1d, $21, $25, $29, $2d, $31, $35, $38, $3c, $40, $43, $47, $4a, $4e, $51, $54, $57, $5a, $5d, $60, $63, $65, $68, $6a, $6c, $6e, $70, $72, $74, $76, $77, $79, $7a, $7b, $7c, $7d, $7e, $7e, $7f, $7f, $7f, $80, $7f, $7f, $7f, $7e, $7e, $7d, $7c, $7b, $7a, $79, $77, $76, $74, $72, $70, $6e, $6c, $6a, $68, $65, $63, $60, $5d, $5a, $57, $54, $51, $4e, $4a, $47, $43, $40, $3c, $38, $35, $31, $2d, $29, $25, $21, $1d, $19, $15, $11, $c, 8, 4, 0, $fc, $f8, $f4, $ef, $eb, $e7, $e3, $df, $db, $d7, $d3, $cf, $cb, $c8, $c4, $c0, $bd, $b9, $b6, $b2, $af, $ac, $a9, $a6, $a3, $a0, $9d, $9b, $98, $96, $94, $92, $90, $8e, $8c, $8a, $89, $87, $86, $85, $84, $83, $82, $82, $81, $81, $81, $81, $81, $81, $81, $82, $82, $83, $84, $85, $86, $87, $89, $8a, $8c, $8e, $90, $92, $94, $96, $98, $9b, $9d, $a0, $a3, $a6, $a9, $ac, $af, $b2, $b6, $b9, $bd, $c0, $c4, $c8, $cb, $cf, $d3, $d7, $db, $df, $e3, $e7, $eb, $ef, $f4, $f8, $fc } // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 b1: @@ -72,6 +73,7 @@ print_str: { jmp b1 } // Print a signed byte as HEX +// print_sbyte(signed byte zeropage(4) b) print_sbyte: { .label b = 4 lda b @@ -92,6 +94,7 @@ print_sbyte: { jmp b2 } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -144,6 +147,7 @@ print_cls: { // Generate signed byte sinus table - on the full -$7f - $7f range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin8s_gen(signed byte* zeropage(5) sintab) sin8s_gen: { .label step = $e .label sintab = 5 @@ -197,6 +201,7 @@ sin8s_gen: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage(9) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -308,6 +313,7 @@ sin8s: { } // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte register(X) v1, byte register(Y) v2, byte zeropage($b) select) mulu8_sel: { .label _0 = 9 .label _1 = 9 @@ -326,6 +332,7 @@ mulu8_sel: { rts } // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = $c .label res = 9 @@ -372,6 +379,7 @@ div16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(5) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 5 diff --git a/src/test/ref/sinusgen8.log b/src/test/ref/sinusgen8.log index 1b0c167f0..9a60bb97d 100644 --- a/src/test/ref/sinusgen8.log +++ b/src/test/ref/sinusgen8.log @@ -2425,6 +2425,7 @@ main: { } //SEG48 print_str // Print a zero-terminated string +// print_str(byte* zeropage(3) str) print_str: { .label str = 3 //SEG49 [22] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -2466,6 +2467,7 @@ print_str: { } //SEG60 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage(5) b) print_sbyte: { .label b = 5 //SEG61 [28] if((signed byte) print_sbyte::b#1<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -2524,6 +2526,7 @@ print_sbyte: { } //SEG82 print_char // Print a single char +// print_char(byte zeropage(6) ch) print_char: { .label ch = 6 //SEG83 [38] *((byte*) print_char_cursor#29) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuz2 @@ -2630,6 +2633,7 @@ print_cls: { // Generate signed byte sinus table - on the full -$7f - $7f range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin8s_gen(signed byte* zeropage($d) sintab) sin8s_gen: { .label _1 = $2d .label step = $2a @@ -2737,6 +2741,7 @@ sin8s_gen: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage($12) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -3022,6 +3027,7 @@ sin8s: { //SEG228 mulu8_sel // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte zeropage($16) v1, byte zeropage($17) v2, byte zeropage($18) select) mulu8_sel: { .label _0 = $40 .label _1 = $42 @@ -3079,6 +3085,7 @@ mulu8_sel: { } //SEG239 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte zeropage($19) a, byte zeropage($3d) b) mul8u: { .label _1 = $45 .label mb = $1c @@ -3188,6 +3195,7 @@ div16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage($20) dividend, word zeropage($1e) rem) divr16u: { .label _1 = $4a .label _2 = $4b @@ -3692,6 +3700,7 @@ main: { } //SEG48 print_str // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 //SEG49 [22] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -3733,6 +3742,7 @@ print_str: { } //SEG60 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage(4) b) print_sbyte: { .label b = 4 //SEG61 [28] if((signed byte) print_sbyte::b#1<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -3789,6 +3799,7 @@ print_sbyte: { } //SEG82 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG83 [38] *((byte*) print_char_cursor#29) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa ldy #0 @@ -3887,6 +3898,7 @@ print_cls: { // Generate signed byte sinus table - on the full -$7f - $7f range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin8s_gen(signed byte* zeropage(5) sintab) sin8s_gen: { .label step = $e .label sintab = 5 @@ -3980,6 +3992,7 @@ sin8s_gen: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage(9) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -4214,6 +4227,7 @@ sin8s: { //SEG228 mulu8_sel // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte register(X) v1, byte register(Y) v2, byte zeropage($b) select) mulu8_sel: { .label _0 = 9 .label _1 = 9 @@ -4247,6 +4261,7 @@ mulu8_sel: { } //SEG239 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = $c .label res = 9 @@ -4342,6 +4357,7 @@ div16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(5) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 5 @@ -5041,6 +5057,7 @@ main: { } //SEG48 print_str // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 //SEG49 [22] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -5076,6 +5093,7 @@ print_str: { } //SEG60 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage(4) b) print_sbyte: { .label b = 4 //SEG61 [28] if((signed byte) print_sbyte::b#1<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -5118,6 +5136,7 @@ print_sbyte: { } //SEG82 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG83 [38] *((byte*) print_char_cursor#29) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa ldy #0 @@ -5202,6 +5221,7 @@ print_cls: { // Generate signed byte sinus table - on the full -$7f - $7f range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin8s_gen(signed byte* zeropage(5) sintab) sin8s_gen: { .label step = $e .label sintab = 5 @@ -5282,6 +5302,7 @@ sin8s_gen: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage(9) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -5480,6 +5501,7 @@ sin8s: { //SEG228 mulu8_sel // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte register(X) v1, byte register(Y) v2, byte zeropage($b) select) mulu8_sel: { .label _0 = 9 .label _1 = 9 @@ -5509,6 +5531,7 @@ mulu8_sel: { } //SEG239 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = $c .label res = 9 @@ -5587,6 +5610,7 @@ div16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(5) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 5 diff --git a/src/test/ref/sinusgen8b.asm b/src/test/ref/sinusgen8b.asm index dae9c9268..de99467cb 100644 --- a/src/test/ref/sinusgen8b.asm +++ b/src/test/ref/sinusgen8b.asm @@ -81,6 +81,7 @@ main: { sintabw: .fill 2*$c0, 0 } // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 b1: @@ -104,6 +105,7 @@ print_str: { jmp b1 } // Print a signed byte as HEX +// print_sbyte(signed byte zeropage(4) b) print_sbyte: { .label b = 4 lda b @@ -124,6 +126,7 @@ print_sbyte: { jmp b2 } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -176,6 +179,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage(2) sintab) sin16s_gen: { .label _1 = $f .label step = $1c @@ -249,6 +253,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($b) x) sin16s: { .label _6 = $b .label x = $b @@ -424,6 +429,7 @@ sin16s: { } // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($11) v1, word zeropage($13) v2, byte register(X) select) mulu16_sel: { .label _0 = $b .label _1 = $b @@ -454,6 +460,7 @@ mulu16_sel: { rts } // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($15) a, word zeropage($13) b) mul16u: { .label mb = $17 .label a = $15 @@ -542,6 +549,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(5) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 5 @@ -594,6 +602,7 @@ divr16u: { // Generate signed byte sinus table - on the full -$7f - $7f range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin8s_gen(signed byte* zeropage(5) sintab) sin8s_gen: { .label step = $f .label sintab = 5 @@ -647,6 +656,7 @@ sin8s_gen: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage($13) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -758,6 +768,7 @@ sin8s: { } // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte register(X) v1, byte register(Y) v2, byte zeropage($1b) select) mulu8_sel: { .label _0 = $13 .label _1 = $13 @@ -776,6 +787,7 @@ mulu8_sel: { rts } // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = $15 .label res = $13 diff --git a/src/test/ref/sinusgen8b.log b/src/test/ref/sinusgen8b.log index ea15ea16b..53f251e10 100644 --- a/src/test/ref/sinusgen8b.log +++ b/src/test/ref/sinusgen8b.log @@ -3691,6 +3691,7 @@ main: { } //SEG58 print_str // Print a zero-terminated string +// print_str(byte* zeropage(3) str) print_str: { .label str = 3 //SEG59 [30] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -3732,6 +3733,7 @@ print_str: { } //SEG70 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage(5) b) print_sbyte: { .label b = 5 //SEG71 [36] if((signed byte) print_sbyte::b#1<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -3790,6 +3792,7 @@ print_sbyte: { } //SEG92 print_char // Print a single char +// print_char(byte zeropage(6) ch) print_char: { .label ch = 6 //SEG93 [46] *((byte*) print_char_cursor#29) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuz2 @@ -3896,6 +3899,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage($f) sintab) sin16s_gen: { .label _1 = $5a .label step = $54 @@ -4033,6 +4037,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($14) x) sin16s: { .label _6 = $5c .label x = $14 @@ -4390,6 +4395,7 @@ sin16s: { //SEG232 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($1a) v1, word zeropage($1c) v2, byte zeropage($1e) select) mulu16_sel: { .label _0 = $82 .label _1 = $86 @@ -4467,6 +4473,7 @@ mulu16_sel: { } //SEG243 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($1f) a, word zeropage($7c) b) mul16u: { .label _1 = $8c .label mb = $25 @@ -4639,6 +4646,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage($2b) dividend, word zeropage($29) rem) divr16u: { .label _1 = $99 .label _2 = $9a @@ -4763,6 +4771,7 @@ divr16u: { // Generate signed byte sinus table - on the full -$7f - $7f range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin8s_gen(signed byte* zeropage($32) sintab) sin8s_gen: { .label _1 = $a2 .label step = $9f @@ -4870,6 +4879,7 @@ sin8s_gen: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage($37) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -5155,6 +5165,7 @@ sin8s: { //SEG437 mulu8_sel // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte zeropage($3b) v1, byte zeropage($3c) v2, byte zeropage($3d) select) mulu8_sel: { .label _0 = $b5 .label _1 = $b7 @@ -5212,6 +5223,7 @@ mulu8_sel: { } //SEG448 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte zeropage($3e) a, byte zeropage($b2) b) mul8u: { .label _1 = $ba .label mb = $41 @@ -5984,6 +5996,7 @@ main: { } //SEG58 print_str // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 //SEG59 [30] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -6025,6 +6038,7 @@ print_str: { } //SEG70 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage(4) b) print_sbyte: { .label b = 4 //SEG71 [36] if((signed byte) print_sbyte::b#1<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -6081,6 +6095,7 @@ print_sbyte: { } //SEG92 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG93 [46] *((byte*) print_char_cursor#29) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa ldy #0 @@ -6179,6 +6194,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage(2) sintab) sin16s_gen: { .label _1 = $f .label step = $1c @@ -6292,6 +6308,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($b) x) sin16s: { .label _6 = $b .label x = $b @@ -6581,6 +6598,7 @@ sin16s: { //SEG232 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($11) v1, word zeropage($13) v2, byte register(X) select) mulu16_sel: { .label _0 = $b .label _1 = $b @@ -6626,6 +6644,7 @@ mulu16_sel: { } //SEG243 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($15) a, word zeropage($13) b) mul16u: { .label mb = $17 .label a = $15 @@ -6778,6 +6797,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(5) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 5 @@ -6886,6 +6906,7 @@ divr16u: { // Generate signed byte sinus table - on the full -$7f - $7f range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin8s_gen(signed byte* zeropage(5) sintab) sin8s_gen: { .label step = $f .label sintab = 5 @@ -6979,6 +7000,7 @@ sin8s_gen: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage($13) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -7213,6 +7235,7 @@ sin8s: { //SEG437 mulu8_sel // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte register(X) v1, byte register(Y) v2, byte zeropage($1b) select) mulu8_sel: { .label _0 = $13 .label _1 = $13 @@ -7246,6 +7269,7 @@ mulu8_sel: { } //SEG448 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = $15 .label res = $13 @@ -8215,6 +8239,7 @@ main: { } //SEG58 print_str // Print a zero-terminated string +// print_str(byte* zeropage(2) str) print_str: { .label str = 2 //SEG59 [30] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -8250,6 +8275,7 @@ print_str: { } //SEG70 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage(4) b) print_sbyte: { .label b = 4 //SEG71 [36] if((signed byte) print_sbyte::b#1<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -8292,6 +8318,7 @@ print_sbyte: { } //SEG92 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG93 [46] *((byte*) print_char_cursor#29) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa ldy #0 @@ -8376,6 +8403,7 @@ print_cls: { // Generate signed (large) word sinus table - on the full -$7fff - $7fff range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin16s_gen(signed word* zeropage(2) sintab) sin16s_gen: { .label _1 = $f .label step = $1c @@ -8476,6 +8504,7 @@ sin16s_gen: { // Calculate signed word sinus sin(x) // x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28 // result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff +// sin16s(dword zeropage($b) x) sin16s: { .label _6 = $b .label x = $b @@ -8732,6 +8761,7 @@ sin16s: { //SEG232 mulu16_sel // Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result. // The select parameter indicates how many of the highest bits of the 32-bit result to skip +// mulu16_sel(word zeropage($11) v1, word zeropage($13) v2, byte register(X) select) mulu16_sel: { .label _0 = $b .label _1 = $b @@ -8773,6 +8803,7 @@ mulu16_sel: { } //SEG243 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($15) a, word zeropage($13) b) mul16u: { .label mb = $17 .label a = $15 @@ -8904,6 +8935,7 @@ div32u16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(5) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 5 @@ -8993,6 +9025,7 @@ divr16u: { // Generate signed byte sinus table - on the full -$7f - $7f range // sintab - the table to generate into // wavelength - the number of sinus points in a total sinus wavelength (the size of the table) +// sin8s_gen(signed byte* zeropage(5) sintab) sin8s_gen: { .label step = $f .label sintab = 5 @@ -9073,6 +9106,7 @@ sin8s_gen: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage($13) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -9271,6 +9305,7 @@ sin8s: { //SEG437 mulu8_sel // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte register(X) v1, byte register(Y) v2, byte zeropage($1b) select) mulu8_sel: { .label _0 = $13 .label _1 = $13 @@ -9300,6 +9335,7 @@ mulu8_sel: { } //SEG448 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = $15 .label res = $13 diff --git a/src/test/ref/sinusgenscale8.asm b/src/test/ref/sinusgenscale8.asm index a583cdc6e..24639ab21 100644 --- a/src/test/ref/sinusgenscale8.asm +++ b/src/test/ref/sinusgenscale8.asm @@ -22,6 +22,7 @@ main: { // tabsize - the number of sinus points (the size of the table) // min - the minimal value // max - the maximal value +// sin8u_table(byte* zeropage(4) sintab) sin8u_table: { .const min = $a .const max = $ff @@ -212,6 +213,7 @@ print_ln: { rts } // Print a byte as HEX +// print_byte(byte zeropage($a) b) print_byte: { .label b = $a lda b @@ -230,6 +232,7 @@ print_byte: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -240,6 +243,7 @@ print_char: { rts } // Print a zero-terminated string +// print_str(byte* zeropage($b) str) print_str: { .label str = $b b1: @@ -263,6 +267,7 @@ print_str: { jmp b1 } // Print a signed word as HEX +// print_sword(signed word zeropage($b) w) print_sword: { .label w = $b lda w+1 @@ -283,6 +288,7 @@ print_sword: { rts } // Print a word as HEX +// print_word(word zeropage($b) w) print_word: { .label w = $b lda w+1 @@ -294,6 +300,7 @@ print_word: { rts } // Print a signed byte as HEX +// print_sbyte(signed byte zeropage($a) b) print_sbyte: { .label b = $a lda b @@ -315,6 +322,7 @@ print_sbyte: { } // Multiply a signed byte and an unsigned byte (into a signed word) // Fixes offsets introduced by using unsigned multiplication +// mul8su(signed byte register(Y) a) mul8su: { .const b = sin8u_table.amplitude+1 .label m = $f @@ -333,6 +341,7 @@ mul8su: { rts } // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = $b .label res = $f @@ -369,6 +378,7 @@ mul8u: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage($b) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -480,6 +490,7 @@ sin8s: { } // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte register(X) v1, byte register(Y) v2, byte zeropage($11) select) mulu8_sel: { .label _0 = $f .label _1 = $f @@ -510,6 +521,7 @@ div16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 diff --git a/src/test/ref/sinusgenscale8.log b/src/test/ref/sinusgenscale8.log index 1303ab763..02ca0e47e 100644 --- a/src/test/ref/sinusgenscale8.log +++ b/src/test/ref/sinusgenscale8.log @@ -3548,6 +3548,7 @@ main: { // tabsize - the number of sinus points (the size of the table) // min - the minimal value // max - the maximal value +// sin8u_table(byte* zeropage(4) sintab) sin8u_table: { .const min = $a .const max = $ff @@ -4000,6 +4001,7 @@ print_ln: { } //SEG171 print_byte // Print a byte as HEX +// print_byte(byte zeropage($a) b) print_byte: { .label _0 = $3b .label _2 = $3c @@ -4046,6 +4048,7 @@ print_byte: { } //SEG187 print_char // Print a single char +// print_char(byte zeropage($b) ch) print_char: { .label ch = $b //SEG188 [83] *((byte*) print_char_cursor#64) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuz2 @@ -4065,6 +4068,7 @@ print_char: { } //SEG192 print_str // Print a zero-terminated string +// print_str(byte* zeropage($c) str) print_str: { .label str = $c //SEG193 [87] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -4106,6 +4110,7 @@ print_str: { } //SEG204 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage($e) w) print_sword: { .label w = $e //SEG205 [93] if((signed word) print_sword::w#1>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -4164,6 +4169,7 @@ print_sword: { } //SEG225 print_word // Print a word as HEX +// print_word(word zeropage($12) w) print_word: { .label w = $12 //SEG226 [102] (byte) print_byte::b#1 ← > (word) print_word::w#3 -- vbuz1=_hi_vwuz2 @@ -4195,6 +4201,7 @@ print_word: { } //SEG239 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage($14) b) print_sbyte: { .label b = $14 //SEG240 [107] if((signed byte) print_sbyte::b#1<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -4261,6 +4268,7 @@ print_sbyte: { //SEG265 mul8su // Multiply a signed byte and an unsigned byte (into a signed word) // Fixes offsets introduced by using unsigned multiplication +// mul8su(signed byte zeropage($34) a) mul8su: { .const b = sin8u_table.amplitude+1 .label _5 = $3f @@ -4329,6 +4337,7 @@ mul8su: { } //SEG285 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte zeropage($18) a, byte zeropage($17) b) mul8u: { .label _1 = $42 .label mb = $1b @@ -4407,6 +4416,7 @@ mul8u: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage($1e) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -4691,6 +4701,7 @@ sin8s: { //SEG396 mulu8_sel // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte zeropage($22) v1, byte zeropage($23) v2, byte zeropage($24) select) mulu8_sel: { .label _0 = $54 .label _1 = $56 @@ -4786,6 +4797,7 @@ div16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage($27) dividend, word zeropage($25) rem) divr16u: { .label _1 = $5d .label _2 = $5e @@ -5323,6 +5335,7 @@ main: { // tabsize - the number of sinus points (the size of the table) // min - the minimal value // max - the maximal value +// sin8u_table(byte* zeropage(4) sintab) sin8u_table: { .const min = $a .const max = $ff @@ -5750,6 +5763,7 @@ print_ln: { } //SEG171 print_byte // Print a byte as HEX +// print_byte(byte zeropage($a) b) print_byte: { .label b = $a //SEG172 [75] (byte~) print_byte::$0 ← (byte) print_byte::b#8 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4 @@ -5790,6 +5804,7 @@ print_byte: { } //SEG187 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG188 [83] *((byte*) print_char_cursor#64) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuaa ldy #0 @@ -5807,6 +5822,7 @@ print_char: { } //SEG192 print_str // Print a zero-terminated string +// print_str(byte* zeropage($b) str) print_str: { .label str = $b //SEG193 [87] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -5848,6 +5864,7 @@ print_str: { } //SEG204 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage($b) w) print_sword: { .label w = $b //SEG205 [93] if((signed word) print_sword::w#1>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -5901,6 +5918,7 @@ print_sword: { } //SEG225 print_word // Print a word as HEX +// print_word(word zeropage($b) w) print_word: { .label w = $b //SEG226 [102] (byte) print_byte::b#1 ← > (word) print_word::w#3 -- vbuz1=_hi_vwuz2 @@ -5932,6 +5950,7 @@ print_word: { } //SEG239 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage($a) b) print_sbyte: { .label b = $a //SEG240 [107] if((signed byte) print_sbyte::b#1<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -5994,6 +6013,7 @@ print_sbyte: { //SEG265 mul8su // Multiply a signed byte and an unsigned byte (into a signed word) // Fixes offsets introduced by using unsigned multiplication +// mul8su(signed byte register(Y) a) mul8su: { .const b = sin8u_table.amplitude+1 .label m = $f @@ -6043,6 +6063,7 @@ mul8su: { } //SEG285 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = $b .label res = $f @@ -6115,6 +6136,7 @@ mul8u: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage($b) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -6349,6 +6371,7 @@ sin8s: { //SEG396 mulu8_sel // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte register(X) v1, byte register(Y) v2, byte zeropage($11) select) mulu8_sel: { .label _0 = $f .label _1 = $f @@ -6411,6 +6434,7 @@ div16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 @@ -6850,8 +6874,8 @@ Removing instruction lda #<0 Succesful ASM optimization Pass5UnnecesaryLoadElimination Removing instruction bbegin: Succesful ASM optimization Pass5UnusedLabelElimination -Fixing long branch [172] bcc b1 to bcs -Fixing long branch [178] bcc b1 to bcs +Fixing long branch [173] bcc b1 to bcs +Fixing long branch [179] bcc b1 to bcs FINAL SYMBOL TABLE (label) @41 @@ -7276,6 +7300,7 @@ main: { // tabsize - the number of sinus points (the size of the table) // min - the minimal value // max - the maximal value +// sin8u_table(byte* zeropage(4) sintab) sin8u_table: { .const min = $a .const max = $ff @@ -7618,6 +7643,7 @@ print_ln: { } //SEG171 print_byte // Print a byte as HEX +// print_byte(byte zeropage($a) b) print_byte: { .label b = $a //SEG172 [75] (byte~) print_byte::$0 ← (byte) print_byte::b#8 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4 @@ -7652,6 +7678,7 @@ print_byte: { } //SEG187 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG188 [83] *((byte*) print_char_cursor#64) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuaa ldy #0 @@ -7667,6 +7694,7 @@ print_char: { } //SEG192 print_str // Print a zero-terminated string +// print_str(byte* zeropage($b) str) print_str: { .label str = $b //SEG193 [87] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -7702,6 +7730,7 @@ print_str: { } //SEG204 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage($b) w) print_sword: { .label w = $b //SEG205 [93] if((signed word) print_sword::w#1>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -7743,6 +7772,7 @@ print_sword: { } //SEG225 print_word // Print a word as HEX +// print_word(word zeropage($b) w) print_word: { .label w = $b //SEG226 [102] (byte) print_byte::b#1 ← > (word) print_word::w#3 -- vbuz1=_hi_vwuz2 @@ -7768,6 +7798,7 @@ print_word: { } //SEG239 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage($a) b) print_sbyte: { .label b = $a //SEG240 [107] if((signed byte) print_sbyte::b#1<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -7815,6 +7846,7 @@ print_sbyte: { //SEG265 mul8su // Multiply a signed byte and an unsigned byte (into a signed word) // Fixes offsets introduced by using unsigned multiplication +// mul8su(signed byte register(Y) a) mul8su: { .const b = sin8u_table.amplitude+1 .label m = $f @@ -7853,6 +7885,7 @@ mul8su: { } //SEG285 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = $b .label res = $f @@ -7913,6 +7946,7 @@ mul8u: { // Calculate signed byte sinus sin(x) // x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12 // result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f +// sin8s(word zeropage($b) x) sin8s: { // u[2.6] x^3 .const DIV_6 = $2b @@ -8111,6 +8145,7 @@ sin8s: { //SEG396 mulu8_sel // Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result. // The select parameter indicates how many of the highest bits of the 16-bit result to skip +// mulu8_sel(byte register(X) v1, byte register(Y) v2, byte zeropage($11) select) mulu8_sel: { .label _0 = $f .label _1 = $f @@ -8163,6 +8198,7 @@ div16u: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(4) dividend, word zeropage(2) rem) divr16u: { .label rem = 2 .label dividend = 4 diff --git a/src/test/ref/summin.asm b/src/test/ref/summin.asm index d92e19d6c..2188c459c 100644 --- a/src/test/ref/summin.asm +++ b/src/test/ref/summin.asm @@ -25,6 +25,7 @@ main: { sta screen rts } +// sum(byte register(Y) a, byte register(A) b) sum: { sty $ff clc diff --git a/src/test/ref/summin.log b/src/test/ref/summin.log index 49dd9e8f4..ed4f0863a 100644 --- a/src/test/ref/summin.log +++ b/src/test/ref/summin.log @@ -384,6 +384,7 @@ main: { rts } //SEG37 sum +// sum(byte zeropage(2) a, byte zeropage(3) b) sum: { .label return = 4 .label return_1 = 6 @@ -534,6 +535,7 @@ main: { rts } //SEG37 sum +// sum(byte register(Y) a, byte register(A) b) sum: { //SEG38 [19] (byte) sum::return#3 ← (byte) sum::a#3 + (byte) sum::b#3 -- vbuaa=vbuyy_plus_vbuaa sty $ff @@ -689,6 +691,7 @@ main: { rts } //SEG37 sum +// sum(byte register(Y) a, byte register(A) b) sum: { //SEG38 [19] (byte) sum::return#3 ← (byte) sum::a#3 + (byte) sum::b#3 -- vbuaa=vbuyy_plus_vbuaa sty $ff diff --git a/src/test/ref/test-address-of-param.asm b/src/test/ref/test-address-of-param.asm index e357fd5d5..7cfbdb225 100644 --- a/src/test/ref/test-address-of-param.asm +++ b/src/test/ref/test-address-of-param.asm @@ -36,6 +36,7 @@ main: { sta SCREEN+2 rts } +// setByte(byte* zeropage(2) ptr, byte register(X) b) setByte: { .label ptr = 2 txa diff --git a/src/test/ref/test-address-of-param.log b/src/test/ref/test-address-of-param.log index 5972b81b9..5e7da97db 100644 --- a/src/test/ref/test-address-of-param.log +++ b/src/test/ref/test-address-of-param.log @@ -334,6 +334,7 @@ main: { rts } //SEG35 setByte +// setByte(byte* zeropage(3) ptr, byte zeropage(2) b) setByte: { .label b = 2 .label ptr = 3 @@ -477,6 +478,7 @@ main: { rts } //SEG35 setByte +// setByte(byte* zeropage(2) ptr, byte register(X) b) setByte: { .label ptr = 2 //SEG36 [17] *((byte*) setByte::ptr#3) ← (byte) setByte::b#3 -- _deref_pbuz1=vbuxx @@ -632,6 +634,7 @@ main: { rts } //SEG35 setByte +// setByte(byte* zeropage(2) ptr, byte register(X) b) setByte: { .label ptr = 2 //SEG36 [17] *((byte*) setByte::ptr#3) ← (byte) setByte::b#3 -- _deref_pbuz1=vbuxx diff --git a/src/test/ref/test-comments-block.asm b/src/test/ref/test-comments-block.asm index d41224e36..915dd8876 100644 --- a/src/test/ref/test-comments-block.asm +++ b/src/test/ref/test-comments-block.asm @@ -28,6 +28,7 @@ main: { * b - the second byte * Returns the sum pf the two bytes */ +// sum(byte register(Y) b) sum: { tya clc diff --git a/src/test/ref/test-comments-block.log b/src/test/ref/test-comments-block.log index a9237fd9a..343b68802 100644 --- a/src/test/ref/test-comments-block.log +++ b/src/test/ref/test-comments-block.log @@ -323,6 +323,7 @@ main: { * b - the second byte * Returns the sum pf the two bytes */ +// sum(byte zeropage(4) b) sum: { .label b = 4 .label return = 5 @@ -438,6 +439,7 @@ main: { * b - the second byte * Returns the sum pf the two bytes */ +// sum(byte register(Y) b) sum: { //SEG30 [15] (byte) sum::return#1 ← (const byte) a#0 + (byte) sum::b#0 -- vbuaa=vbuc1_plus_vbuyy tya @@ -579,6 +581,7 @@ main: { * b - the second byte * Returns the sum pf the two bytes */ +// sum(byte register(Y) b) sum: { //SEG30 [15] (byte) sum::return#1 ← (const byte) a#0 + (byte) sum::b#0 -- vbuaa=vbuc1_plus_vbuyy tya diff --git a/src/test/ref/test-comments-single.asm b/src/test/ref/test-comments-single.asm index 398991d77..a1e492ded 100644 --- a/src/test/ref/test-comments-single.asm +++ b/src/test/ref/test-comments-single.asm @@ -26,6 +26,7 @@ main: { // a - the first byte // b - the second byte // Returns the sum pf the two bytes +// sum(byte register(Y) b) sum: { tya clc diff --git a/src/test/ref/test-comments-single.log b/src/test/ref/test-comments-single.log index 97ccf67fb..4ba69b024 100644 --- a/src/test/ref/test-comments-single.log +++ b/src/test/ref/test-comments-single.log @@ -321,6 +321,7 @@ main: { // a - the first byte // b - the second byte // Returns the sum pf the two bytes +// sum(byte zeropage(4) b) sum: { .label b = 4 .label return = 5 @@ -434,6 +435,7 @@ main: { // a - the first byte // b - the second byte // Returns the sum pf the two bytes +// sum(byte register(Y) b) sum: { //SEG30 [15] (byte) sum::return#1 ← (const byte) a#0 + (byte) sum::b#0 -- vbuaa=vbuc1_plus_vbuyy tya @@ -573,6 +575,7 @@ main: { // a - the first byte // b - the second byte // Returns the sum pf the two bytes +// sum(byte register(Y) b) sum: { //SEG30 [15] (byte) sum::return#1 ← (const byte) a#0 + (byte) sum::b#0 -- vbuaa=vbuc1_plus_vbuyy tya diff --git a/src/test/ref/test-comparisons.asm b/src/test/ref/test-comparisons.asm index 1cfbca1fa..605b3135b 100644 --- a/src/test/ref/test-comparisons.asm +++ b/src/test/ref/test-comparisons.asm @@ -416,6 +416,7 @@ print_ln: { !: rts } +// printu(byte zeropage(2) a, byte[] zeropage(6) op, byte zeropage(8) b, byte register(X) res) printu: { .label a = 2 .label b = 8 @@ -436,6 +437,7 @@ printu: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -446,6 +448,7 @@ print_char: { rts } // Print a byte as HEX +// print_byte(byte zeropage($b) b) print_byte: { .label b = $b lda b @@ -464,6 +467,7 @@ print_byte: { rts } // Print a zero-terminated string +// print_str(byte* zeropage(6) str) print_str: { .label str = 6 b1: diff --git a/src/test/ref/test-comparisons.log b/src/test/ref/test-comparisons.log index 982e48114..9553e10bc 100644 --- a/src/test/ref/test-comparisons.log +++ b/src/test/ref/test-comparisons.log @@ -4267,6 +4267,7 @@ print_ln: { rts } //SEG444 printu +// printu(byte zeropage($1a) a, byte[] zeropage($1b) op, byte zeropage($1d) b, byte zeropage($1e) res) printu: { .label a = $1a .label b = $1d @@ -4349,6 +4350,7 @@ printu: { } //SEG479 print_char // Print a single char +// print_char(byte zeropage($1f) ch) print_char: { .label ch = $1f //SEG480 [181] *((byte*) print_char_cursor#54) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuz2 @@ -4368,6 +4370,7 @@ print_char: { } //SEG484 print_byte // Print a byte as HEX +// print_byte(byte zeropage($22) b) print_byte: { .label _0 = $28 .label _2 = $29 @@ -4414,6 +4417,7 @@ print_byte: { } //SEG500 print_str // Print a zero-terminated string +// print_str(byte* zeropage($23) str) print_str: { .label str = $23 //SEG501 [193] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -5792,6 +5796,7 @@ print_ln: { rts } //SEG444 printu +// printu(byte zeropage(2) a, byte[] zeropage(6) op, byte zeropage(8) b, byte register(X) res) printu: { .label a = 2 .label b = 8 @@ -5866,6 +5871,7 @@ printu: { } //SEG479 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG480 [181] *((byte*) print_char_cursor#54) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuaa ldy #0 @@ -5883,6 +5889,7 @@ print_char: { } //SEG484 print_byte // Print a byte as HEX +// print_byte(byte zeropage($b) b) print_byte: { .label b = $b //SEG485 [185] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4 @@ -5923,6 +5930,7 @@ print_byte: { } //SEG500 print_str // Print a zero-terminated string +// print_str(byte* zeropage(6) str) print_str: { .label str = 6 //SEG501 [193] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -7430,6 +7438,7 @@ print_ln: { rts } //SEG444 printu +// printu(byte zeropage(2) a, byte[] zeropage(6) op, byte zeropage(8) b, byte register(X) res) printu: { .label a = 2 .label b = 8 @@ -7485,6 +7494,7 @@ printu: { } //SEG479 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG480 [181] *((byte*) print_char_cursor#54) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuaa ldy #0 @@ -7500,6 +7510,7 @@ print_char: { } //SEG484 print_byte // Print a byte as HEX +// print_byte(byte zeropage($b) b) print_byte: { .label b = $b //SEG485 [185] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4 @@ -7534,6 +7545,7 @@ print_byte: { } //SEG500 print_str // Print a zero-terminated string +// print_str(byte* zeropage(6) str) print_str: { .label str = 6 //SEG501 [193] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] diff --git a/src/test/ref/test-division.asm b/src/test/ref/test-division.asm index 3c8f0c837..e96748488 100644 --- a/src/test/ref/test-division.asm +++ b/src/test/ref/test-division.asm @@ -102,6 +102,7 @@ print_ln: { rts } // Print a signed word as HEX +// print_sword(signed word zeropage(5) w) print_sword: { .label w = 5 lda w+1 @@ -122,6 +123,7 @@ print_sword: { rts } // Print a word as HEX +// print_word(word zeropage(5) w) print_word: { .label w = 5 lda w+1 @@ -133,6 +135,7 @@ print_word: { rts } // Print a byte as HEX +// print_byte(byte zeropage(7) b) print_byte: { .label b = 7 lda b @@ -151,6 +154,7 @@ print_byte: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -161,6 +165,7 @@ print_char: { rts } // Print a zero-terminated string +// print_str(byte* zeropage(5) str) print_str: { .label str = 5 b1: @@ -189,6 +194,7 @@ print_str: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// div16s(signed word zeropage(5) dividend, signed word zeropage($13) divisor) div16s: { .label return = $e .label dividend = 5 @@ -209,6 +215,7 @@ div16s: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// divr16s(signed word zeropage(8) dividend, signed word zeropage($c) divisor) divr16s: { .const rem = 0 .label _5 = 8 @@ -289,6 +296,7 @@ divr16s: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(8) dividend, word zeropage($c) divisor, word zeropage($a) rem) divr16u: { .label rem = $a .label dividend = 8 @@ -397,6 +405,7 @@ test_8s: { divisors: .byte 5, 7, -$b, -$d, $11, $13 } // Print a signed byte as HEX +// print_sbyte(signed byte zeropage(7) b) print_sbyte: { .label b = 7 lda b @@ -422,6 +431,7 @@ print_sbyte: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// div8s(signed byte register(Y) dividend, signed byte register(X) divisor) div8s: { .label neg = $10 cpy #0 @@ -476,6 +486,7 @@ div8s: { // Returns dividend/divisor. // The remainder will be set into the global variable rem8u // Implemented using simple binary division +// div8u(byte register(A) dividend, byte register(X) divisor) div8u: { sta divr8u.dividend stx divr8u.divisor @@ -487,6 +498,7 @@ div8u: { // Returns dividend/divisor. // The final remainder will be set into the global variable rem8u // Implemented using simple binary division +// divr8u(byte zeropage($11) dividend, byte zeropage($16) divisor, byte register(Y) rem) divr8u: { .label dividend = $11 .label divisor = $16 @@ -596,6 +608,7 @@ test_16u: { // Returns the quotient dividend/divisor. // The remainder will be set into the global variable rem16u // Implemented using simple binary division +// div16u(word zeropage(5) dividend, word zeropage($c) divisor) div16u: { .label return = $e .label dividend = 5 diff --git a/src/test/ref/test-division.log b/src/test/ref/test-division.log index a044e3799..da19fe3e0 100644 --- a/src/test/ref/test-division.log +++ b/src/test/ref/test-division.log @@ -4774,6 +4774,7 @@ print_ln: { } //SEG102 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(5) w) print_sword: { .label w = 5 //SEG103 [50] if((signed word) print_sword::w#5>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -4832,6 +4833,7 @@ print_sword: { } //SEG123 print_word // Print a word as HEX +// print_word(word zeropage(7) w) print_word: { .label w = 7 //SEG124 [59] (byte) print_byte::b#1 ← > (word) print_word::w#5 -- vbuz1=_hi_vwuz2 @@ -4863,6 +4865,7 @@ print_word: { } //SEG137 print_byte // Print a byte as HEX +// print_byte(byte zeropage(9) b) print_byte: { .label _0 = $40 .label _2 = $41 @@ -4909,6 +4912,7 @@ print_byte: { } //SEG153 print_char // Print a single char +// print_char(byte zeropage($a) ch) print_char: { .label ch = $a //SEG154 [73] *((byte*) print_char_cursor#82) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuz2 @@ -4928,6 +4932,7 @@ print_char: { } //SEG158 print_str // Print a zero-terminated string +// print_str(byte* zeropage($d) str) print_str: { .label str = $d //SEG159 [77] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -4974,6 +4979,7 @@ print_str: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// div16s(signed word zeropage($38) dividend, signed word zeropage($3a) divisor) div16s: { .label return = $48 .label dividend = $38 @@ -5016,6 +5022,7 @@ div16s: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// divr16s(signed word zeropage($42) dividend, signed word zeropage($44) divisor) divr16s: { .const rem = 0 .label _5 = $50 @@ -5215,6 +5222,7 @@ divr16s: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage($1e) dividend, word zeropage($1a) divisor, word zeropage($1c) rem) divr16u: { .label _1 = $52 .label _2 = $53 @@ -5502,6 +5510,7 @@ test_8s: { } //SEG329 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage($24) b) print_sbyte: { .label b = $24 //SEG330 [161] if((signed byte) print_sbyte::b#10<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -5572,6 +5581,7 @@ print_sbyte: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// div8s(signed byte zeropage($58) dividend, signed byte zeropage($59) divisor) div8s: { .label _2 = $5f .label _6 = $5e @@ -5717,6 +5727,7 @@ div8s: { // Returns dividend/divisor. // The remainder will be set into the global variable rem8u // Implemented using simple binary division +// div8u(byte zeropage($2a) dividend, byte zeropage($2b) divisor) div8u: { .label return = $62 .label dividend = $2a @@ -5753,6 +5764,7 @@ div8u: { // Returns dividend/divisor. // The final remainder will be set into the global variable rem8u // Implemented using simple binary division +// divr8u(byte zeropage($2d) dividend, byte zeropage($60) divisor, byte zeropage($2c) rem) divr8u: { .label _1 = $63 .label dividend = $2d @@ -6045,6 +6057,7 @@ test_16u: { // Returns the quotient dividend/divisor. // The remainder will be set into the global variable rem16u // Implemented using simple binary division +// div16u(word zeropage($69) dividend, word zeropage($6b) divisor) div16u: { .label return = $73 .label dividend = $69 @@ -7024,6 +7037,7 @@ print_ln: { } //SEG102 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(5) w) print_sword: { .label w = 5 //SEG103 [50] if((signed word) print_sword::w#5>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -7077,6 +7091,7 @@ print_sword: { } //SEG123 print_word // Print a word as HEX +// print_word(word zeropage(5) w) print_word: { .label w = 5 //SEG124 [59] (byte) print_byte::b#1 ← > (word) print_word::w#5 -- vbuz1=_hi_vwuz2 @@ -7108,6 +7123,7 @@ print_word: { } //SEG137 print_byte // Print a byte as HEX +// print_byte(byte zeropage(7) b) print_byte: { .label b = 7 //SEG138 [65] (byte~) print_byte::$0 ← (byte) print_byte::b#7 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4 @@ -7148,6 +7164,7 @@ print_byte: { } //SEG153 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG154 [73] *((byte*) print_char_cursor#82) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuaa ldy #0 @@ -7165,6 +7182,7 @@ print_char: { } //SEG158 print_str // Print a zero-terminated string +// print_str(byte* zeropage(5) str) print_str: { .label str = 5 //SEG159 [77] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -7211,6 +7229,7 @@ print_str: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// div16s(signed word zeropage(5) dividend, signed word zeropage($13) divisor) div16s: { .label return = $e .label dividend = 5 @@ -7244,6 +7263,7 @@ div16s: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// divr16s(signed word zeropage(8) dividend, signed word zeropage($c) divisor) divr16s: { .const rem = 0 .label _5 = 8 @@ -7394,6 +7414,7 @@ divr16s: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(8) dividend, word zeropage($c) divisor, word zeropage($a) rem) divr16u: { .label rem = $a .label dividend = 8 @@ -7658,6 +7679,7 @@ test_8s: { } //SEG329 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage(7) b) print_sbyte: { .label b = 7 //SEG330 [161] if((signed byte) print_sbyte::b#10<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -7724,6 +7746,7 @@ print_sbyte: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// div8s(signed byte register(Y) dividend, signed byte register(X) divisor) div8s: { .label neg = $10 //SEG356 [171] if((signed byte) div8s::dividend#0<(byte/signed byte/word/signed word/dword/signed dword) 0) goto div8s::@1 -- vbsyy_lt_0_then_la1 @@ -7842,6 +7865,7 @@ div8s: { // Returns dividend/divisor. // The remainder will be set into the global variable rem8u // Implemented using simple binary division +// div8u(byte register(A) dividend, byte register(X) divisor) div8u: { //SEG402 [195] (byte) divr8u::dividend#0 ← (byte) div8u::dividend#2 -- vbuz1=vbuaa sta divr8u.dividend @@ -7868,6 +7892,7 @@ div8u: { // Returns dividend/divisor. // The final remainder will be set into the global variable rem8u // Implemented using simple binary division +// divr8u(byte zeropage($11) dividend, byte zeropage($16) divisor, byte register(Y) rem) divr8u: { .label dividend = $11 .label divisor = $16 @@ -8132,6 +8157,7 @@ test_16u: { // Returns the quotient dividend/divisor. // The remainder will be set into the global variable rem16u // Implemented using simple binary division +// div16u(word zeropage(5) dividend, word zeropage($c) divisor) div16u: { .label return = $e .label dividend = 5 @@ -9416,6 +9442,7 @@ print_ln: { } //SEG102 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(5) w) print_sword: { .label w = 5 //SEG103 [50] if((signed word) print_sword::w#5>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -9457,6 +9484,7 @@ print_sword: { } //SEG123 print_word // Print a word as HEX +// print_word(word zeropage(5) w) print_word: { .label w = 5 //SEG124 [59] (byte) print_byte::b#1 ← > (word) print_word::w#5 -- vbuz1=_hi_vwuz2 @@ -9482,6 +9510,7 @@ print_word: { } //SEG137 print_byte // Print a byte as HEX +// print_byte(byte zeropage(7) b) print_byte: { .label b = 7 //SEG138 [65] (byte~) print_byte::$0 ← (byte) print_byte::b#7 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuz1_ror_4 @@ -9516,6 +9545,7 @@ print_byte: { } //SEG153 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG154 [73] *((byte*) print_char_cursor#82) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuaa ldy #0 @@ -9531,6 +9561,7 @@ print_char: { } //SEG158 print_str // Print a zero-terminated string +// print_str(byte* zeropage(5) str) print_str: { .label str = 5 //SEG159 [77] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -9571,6 +9602,7 @@ print_str: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// div16s(signed word zeropage(5) dividend, signed word zeropage($13) divisor) div16s: { .label return = $e .label dividend = 5 @@ -9600,6 +9632,7 @@ div16s: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// divr16s(signed word zeropage(8) dividend, signed word zeropage($c) divisor) divr16s: { .const rem = 0 .label _5 = 8 @@ -9730,6 +9763,7 @@ divr16s: { // Returns the quotient dividend/divisor. // The final remainder will be set into the global variable rem16u // Implemented using simple binary division +// divr16u(word zeropage(8) dividend, word zeropage($c) divisor, word zeropage($a) rem) divr16u: { .label rem = $a .label dividend = 8 @@ -9938,6 +9972,7 @@ test_8s: { } //SEG329 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage(7) b) print_sbyte: { .label b = 7 //SEG330 [161] if((signed byte) print_sbyte::b#10<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -9989,6 +10024,7 @@ print_sbyte: { // Implemented using simple binary division // Follows the C99 standard by truncating toward zero on negative results. // See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5 +// div8s(signed byte register(Y) dividend, signed byte register(X) divisor) div8s: { .label neg = $10 //SEG356 [171] if((signed byte) div8s::dividend#0<(byte/signed byte/word/signed word/dword/signed dword) 0) goto div8s::@1 -- vbsyy_lt_0_then_la1 @@ -10089,6 +10125,7 @@ div8s: { // Returns dividend/divisor. // The remainder will be set into the global variable rem8u // Implemented using simple binary division +// div8u(byte register(A) dividend, byte register(X) divisor) div8u: { //SEG402 [195] (byte) divr8u::dividend#0 ← (byte) div8u::dividend#2 -- vbuz1=vbuaa sta divr8u.dividend @@ -10110,6 +10147,7 @@ div8u: { // Returns dividend/divisor. // The final remainder will be set into the global variable rem8u // Implemented using simple binary division +// divr8u(byte zeropage($11) dividend, byte zeropage($16) divisor, byte register(Y) rem) divr8u: { .label dividend = $11 .label divisor = $16 @@ -10318,6 +10356,7 @@ test_16u: { // Returns the quotient dividend/divisor. // The remainder will be set into the global variable rem16u // Implemented using simple binary division +// div16u(word zeropage(5) dividend, word zeropage($c) divisor) div16u: { .label return = $e .label dividend = 5 diff --git a/src/test/ref/test-keyboard.asm b/src/test/ref/test-keyboard.asm index 7dbef21a3..f68af9345 100644 --- a/src/test/ref/test-keyboard.asm +++ b/src/test/ref/test-keyboard.asm @@ -177,6 +177,7 @@ main: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte register(Y) key) keyboard_key_pressed: { .label colidx = 5 tya @@ -197,6 +198,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(Y) rowid) keyboard_matrix_read: { lda keyboard_matrix_row_bitmask,y sta CIA1_PORT_A @@ -208,6 +210,7 @@ keyboard_matrix_read: { // ch is the character to get the key code for ($00-$3f) // Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled. // If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) . +// keyboard_get_keycode(byte register(Y) ch) keyboard_get_keycode: { lda keyboard_char_keycodes,y rts diff --git a/src/test/ref/test-keyboard.log b/src/test/ref/test-keyboard.log index d5d46aa17..2f549dac0 100644 --- a/src/test/ref/test-keyboard.log +++ b/src/test/ref/test-keyboard.log @@ -1959,6 +1959,7 @@ main: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte zeropage($13) key) keyboard_key_pressed: { .label _2 = $19 .label colidx = $16 @@ -2010,6 +2011,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte zeropage($b) rowid) keyboard_matrix_read: { .label return = $1b .label rowid = $b @@ -2034,6 +2036,7 @@ keyboard_matrix_read: { // ch is the character to get the key code for ($00-$3f) // Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled. // If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) . +// keyboard_get_keycode(byte zeropage($10) ch) keyboard_get_keycode: { .label return = $1c .label ch = $10 @@ -2503,6 +2506,7 @@ main: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte register(Y) key) keyboard_key_pressed: { .label colidx = 5 //SEG96 [49] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuyy_band_vbuc1 @@ -2541,6 +2545,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(Y) rowid) keyboard_matrix_read: { //SEG109 [58] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) -- _deref_pbuc1=pbuc2_derefidx_vbuyy lda keyboard_matrix_row_bitmask,y @@ -2559,6 +2564,7 @@ keyboard_matrix_read: { // ch is the character to get the key code for ($00-$3f) // Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled. // If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) . +// keyboard_get_keycode(byte register(Y) ch) keyboard_get_keycode: { //SEG114 [61] (byte) keyboard_get_keycode::return#0 ← *((const byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#0) -- vbuaa=pbuc1_derefidx_vbuyy lda keyboard_char_keycodes,y @@ -3278,6 +3284,7 @@ main: { // The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7) // All keys exist as as KEY_XXX constants. // Returns zero if the key is not pressed and a non-zero value if the key is currently pressed +// keyboard_key_pressed(byte register(Y) key) keyboard_key_pressed: { .label colidx = 5 //SEG96 [49] (byte) keyboard_key_pressed::colidx#0 ← (byte) keyboard_key_pressed::key#0 & (byte/signed byte/word/signed word/dword/signed dword) 7 -- vbuz1=vbuyy_band_vbuc1 @@ -3311,6 +3318,7 @@ keyboard_key_pressed: { // Returns the keys pressed on the row as bits according to the C64 key matrix. // Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write // leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader. +// keyboard_matrix_read(byte register(Y) rowid) keyboard_matrix_read: { //SEG109 [58] *((const byte*) CIA1_PORT_A#0) ← *((const byte[8]) keyboard_matrix_row_bitmask#0 + (byte) keyboard_matrix_read::rowid#2) -- _deref_pbuc1=pbuc2_derefidx_vbuyy lda keyboard_matrix_row_bitmask,y @@ -3327,6 +3335,7 @@ keyboard_matrix_read: { // ch is the character to get the key code for ($00-$3f) // Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled. // If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) . +// keyboard_get_keycode(byte register(Y) ch) keyboard_get_keycode: { //SEG114 [61] (byte) keyboard_get_keycode::return#0 ← *((const byte[]) keyboard_char_keycodes#0 + (byte) keyboard_get_keycode::ch#0) -- vbuaa=pbuc1_derefidx_vbuyy lda keyboard_char_keycodes,y diff --git a/src/test/ref/test-lowhigh.asm b/src/test/ref/test-lowhigh.asm index 6f6e73397..3237c84f1 100644 --- a/src/test/ref/test-lowhigh.asm +++ b/src/test/ref/test-lowhigh.asm @@ -176,6 +176,7 @@ print_ln: { rts } // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { txa lsr @@ -193,6 +194,7 @@ print_byte: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -203,6 +205,7 @@ print_char: { rts } // Print a word as HEX +// print_word(word zeropage($a) w) print_word: { .label w = $a lda w+1 @@ -214,6 +217,7 @@ print_word: { rts } // Print a dword as HEX +// print_dword(dword zeropage($c) dw) print_dword: { .label dw = $c lda dw+2 diff --git a/src/test/ref/test-lowhigh.log b/src/test/ref/test-lowhigh.log index 616d1a908..d16f596a7 100644 --- a/src/test/ref/test-lowhigh.log +++ b/src/test/ref/test-lowhigh.log @@ -1493,6 +1493,7 @@ print_ln: { } //SEG127 print_byte // Print a byte as HEX +// print_byte(byte zeropage(8) b) print_byte: { .label _0 = $30 .label _2 = $31 @@ -1539,6 +1540,7 @@ print_byte: { } //SEG143 print_char // Print a single char +// print_char(byte zeropage(9) ch) print_char: { .label ch = 9 //SEG144 [65] *((byte*) print_char_cursor#44) ← (byte) print_char::ch#8 -- _deref_pbuz1=vbuz2 @@ -1558,6 +1560,7 @@ print_char: { } //SEG148 print_word // Print a word as HEX +// print_word(word zeropage($c) w) print_word: { .label w = $c //SEG149 [69] (byte) print_byte::b#0 ← > (word) print_word::w#4 -- vbuz1=_hi_vwuz2 @@ -1589,6 +1592,7 @@ print_word: { } //SEG162 print_dword // Print a dword as HEX +// print_dword(dword zeropage($24) dw) print_dword: { .label dw = $24 //SEG163 [74] (word) print_word::w#0 ← > (dword) print_dword::dw#0 -- vwuz1=_hi_vduz2 @@ -2164,6 +2168,7 @@ print_ln: { } //SEG127 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG128 [57] (byte~) print_byte::$0 ← (byte) print_byte::b#6 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -2203,6 +2208,7 @@ print_byte: { } //SEG143 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG144 [65] *((byte*) print_char_cursor#44) ← (byte) print_char::ch#8 -- _deref_pbuz1=vbuaa ldy #0 @@ -2220,6 +2226,7 @@ print_char: { } //SEG148 print_word // Print a word as HEX +// print_word(word zeropage($a) w) print_word: { .label w = $a //SEG149 [69] (byte) print_byte::b#0 ← > (word) print_word::w#4 -- vbuxx=_hi_vwuz1 @@ -2251,6 +2258,7 @@ print_word: { } //SEG162 print_dword // Print a dword as HEX +// print_dword(dword zeropage($c) dw) print_dword: { .label dw = $c //SEG163 [74] (word) print_word::w#0 ← > (dword) print_dword::dw#0 -- vwuz1=_hi_vduz2 @@ -2851,6 +2859,7 @@ print_ln: { } //SEG127 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG128 [57] (byte~) print_byte::$0 ← (byte) print_byte::b#6 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -2884,6 +2893,7 @@ print_byte: { } //SEG143 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG144 [65] *((byte*) print_char_cursor#44) ← (byte) print_char::ch#8 -- _deref_pbuz1=vbuaa ldy #0 @@ -2899,6 +2909,7 @@ print_char: { } //SEG148 print_word // Print a word as HEX +// print_word(word zeropage($a) w) print_word: { .label w = $a //SEG149 [69] (byte) print_byte::b#0 ← > (word) print_word::w#4 -- vbuxx=_hi_vwuz1 @@ -2924,6 +2935,7 @@ print_word: { } //SEG162 print_dword // Print a dword as HEX +// print_dword(dword zeropage($c) dw) print_dword: { .label dw = $c //SEG163 [74] (word) print_word::w#0 ← > (dword) print_dword::dw#0 -- vwuz1=_hi_vduz2 diff --git a/src/test/ref/test-multiply-16bit.asm b/src/test/ref/test-multiply-16bit.asm index fcb2e61f1..c24b19540 100644 --- a/src/test/ref/test-multiply-16bit.asm +++ b/src/test/ref/test-multiply-16bit.asm @@ -147,6 +147,7 @@ print_ln: { rts } // Print a zero-terminated string +// print_str(byte* zeropage(9) str) print_str: { .label str = 9 b1: @@ -169,6 +170,7 @@ print_str: { !: jmp b1 } +// mul16s_error(signed word zeropage(3) a, signed word zeropage(5) b, signed dword zeropage($b) ms, signed dword zeropage($19) mn, signed dword zeropage($11) mf) mul16s_error: { .label a = 3 .label b = 5 @@ -234,6 +236,7 @@ mul16s_error: { str4: .text " / fast:@" } // Print a signed dword as HEX +// print_sdword(signed dword zeropage($b) dw) print_sdword: { .label dw = $b lda dw+3 @@ -262,6 +265,7 @@ print_sdword: { rts } // Print a dword as HEX +// print_dword(dword zeropage($b) dw) print_dword: { .label dw = $b lda dw+2 @@ -277,6 +281,7 @@ print_dword: { rts } // Print a word as HEX +// print_word(word zeropage(3) w) print_word: { .label w = 3 lda w+1 @@ -288,6 +293,7 @@ print_word: { rts } // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { txa lsr @@ -305,6 +311,7 @@ print_byte: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -315,6 +322,7 @@ print_char: { rts } // Print a signed word as HEX +// print_sword(signed word zeropage(3) w) print_sword: { .label w = 3 lda w+1 @@ -336,6 +344,7 @@ print_sword: { } // Fast multiply two signed words to a signed double word result // Fixes offsets introduced by using unsigned multiplication +// mulf16s(signed word zeropage(3) a, signed word zeropage(5) b) mulf16s: { .label _5 = 3 .label _6 = 9 @@ -404,6 +413,7 @@ mulf16s: { } // Fast multiply two unsigned words to a double word result // Done in assembler to utilize fast addition A+X +// mulf16u(word zeropage($15) a, word zeropage($17) b) mulf16u: { .label memA = $f8 .label memB = $fa @@ -523,6 +533,7 @@ mulf16u: { } // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage(3) a, signed word zeropage(5) b) mul16s: { .label _5 = 3 .label _6 = 9 @@ -590,6 +601,7 @@ mul16s: { rts } // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage(9) a, word zeropage($17) b) mul16u: { .label mb = $11 .label a = 9 @@ -643,6 +655,7 @@ mul16u: { } // Slow multiplication of signed words // Perform a signed multiplication by repeated addition/subtraction +// muls16s(signed word zeropage(3) a, signed word zeropage(5) b) muls16s: { .label m = $b .label j = 9 @@ -870,6 +883,7 @@ mul16u_compare: { str: .text ".@" str1: .text "word multiply results match!@" } +// mul16u_error(word zeropage(3) a, word zeropage($17) b, dword zeropage($b) ms, dword zeropage($19) mn, dword zeropage($11) mf) mul16u_error: { .label a = 3 .label b = $17 @@ -940,6 +954,7 @@ mul16u_error: { } // Slow multiplication of unsigned words // Calculate an unsigned multiplication by repeated addition +// muls16u(word zeropage($15) a, word zeropage($17) b) muls16u: { .label return = $b .label m = $b diff --git a/src/test/ref/test-multiply-16bit.log b/src/test/ref/test-multiply-16bit.log index f8c12423f..f051ccf51 100644 --- a/src/test/ref/test-multiply-16bit.log +++ b/src/test/ref/test-multiply-16bit.log @@ -5178,6 +5178,7 @@ print_ln: { } //SEG132 print_str // Print a zero-terminated string +// print_str(byte* zeropage($b) str) print_str: { .label str = $b //SEG133 [65] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -5218,6 +5219,7 @@ print_str: { jmp b1_from_b2 } //SEG144 mul16s_error +// mul16s_error(signed word zeropage($7e) a, signed word zeropage($80) b, signed dword zeropage($82) ms, signed dword zeropage($86) mn, signed dword zeropage($8a) mf) mul16s_error: { .label a = $7e .label b = $80 @@ -5395,6 +5397,7 @@ mul16s_error: { } //SEG206 print_sdword // Print a signed dword as HEX +// print_sdword(signed dword zeropage($d) dw) print_sdword: { .label dw = $d //SEG207 [95] if((signed dword) print_sdword::dw#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sdword::@1 -- vdsz1_ge_0_then_la1 @@ -5465,6 +5468,7 @@ print_sdword: { } //SEG227 print_dword // Print a dword as HEX +// print_dword(dword zeropage($11) dw) print_dword: { .label dw = $11 //SEG228 [104] (word) print_word::w#1 ← > (dword) print_dword::dw#4 -- vwuz1=_hi_vduz2 @@ -5500,6 +5504,7 @@ print_dword: { } //SEG241 print_word // Print a word as HEX +// print_word(word zeropage($15) w) print_word: { .label w = $15 //SEG242 [110] (byte) print_byte::b#0 ← > (word) print_word::w#5 -- vbuz1=_hi_vwuz2 @@ -5531,6 +5536,7 @@ print_word: { } //SEG255 print_byte // Print a byte as HEX +// print_byte(byte zeropage($17) b) print_byte: { .label _0 = $8e .label _2 = $8f @@ -5577,6 +5583,7 @@ print_byte: { } //SEG271 print_char // Print a single char +// print_char(byte zeropage($18) ch) print_char: { .label ch = $18 //SEG272 [124] *((byte*) print_char_cursor#84) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuz2 @@ -5596,6 +5603,7 @@ print_char: { } //SEG276 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage($1b) w) print_sword: { .label w = $1b //SEG277 [128] if((signed word) print_sword::w#3>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -5655,6 +5663,7 @@ print_sword: { //SEG297 mulf16s // Fast multiply two signed words to a signed double word result // Fixes offsets introduced by using unsigned multiplication +// mulf16s(signed word zeropage($72) a, signed word zeropage($74) b) mulf16s: { .label _5 = $94 .label _6 = $96 @@ -5794,6 +5803,7 @@ mulf16s: { //SEG328 mulf16u // Fast multiply two unsigned words to a double word result // Done in assembler to utilize fast addition A+X +// mulf16u(word zeropage($21) a, word zeropage($23) b) mulf16u: { .label memA = $f8 .label memB = $fa @@ -5924,6 +5934,7 @@ mulf16u: { //SEG335 mul16s // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage($66) a, signed word zeropage($68) b) mul16s: { .label _5 = $ac .label _6 = $ae @@ -6062,6 +6073,7 @@ mul16s: { } //SEG366 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage($2b) a, word zeropage($29) b) mul16u: { .label _1 = $bc .label mb = $31 @@ -6155,6 +6167,7 @@ mul16u: { //SEG390 muls16s // Slow multiplication of signed words // Perform a signed multiplication by repeated addition/subtraction +// muls16s(signed word zeropage($5a) a, signed word zeropage($5c) b) muls16s: { .label m = $37 .label j = $35 @@ -6691,6 +6704,7 @@ mul16u_compare: { str1: .text "word multiply results match!@" } //SEG524 mul16u_error +// mul16u_error(word zeropage($d9) a, word zeropage($db) b, dword zeropage($dd) ms, dword zeropage($e1) mn, dword zeropage($e5) mf) mul16u_error: { .label a = $d9 .label b = $db @@ -6878,6 +6892,7 @@ mul16u_error: { //SEG591 muls16u // Slow multiplication of unsigned words // Calculate an unsigned multiplication by repeated addition +// muls16u(word zeropage($bd) a, word zeropage($bf) b) muls16u: { .label return = $46 .label m = $46 @@ -8115,6 +8130,7 @@ print_ln: { } //SEG132 print_str // Print a zero-terminated string +// print_str(byte* zeropage(9) str) print_str: { .label str = 9 //SEG133 [65] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -8155,6 +8171,7 @@ print_str: { jmp b1_from_b2 } //SEG144 mul16s_error +// mul16s_error(signed word zeropage(3) a, signed word zeropage(5) b, signed dword zeropage($b) ms, signed dword zeropage($19) mn, signed dword zeropage($11) mf) mul16s_error: { .label a = 3 .label b = 5 @@ -8320,6 +8337,7 @@ mul16s_error: { } //SEG206 print_sdword // Print a signed dword as HEX +// print_sdword(signed dword zeropage($b) dw) print_sdword: { .label dw = $b //SEG207 [95] if((signed dword) print_sdword::dw#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sdword::@1 -- vdsz1_ge_0_then_la1 @@ -8381,6 +8399,7 @@ print_sdword: { } //SEG227 print_dword // Print a dword as HEX +// print_dword(dword zeropage($b) dw) print_dword: { .label dw = $b //SEG228 [104] (word) print_word::w#1 ← > (dword) print_dword::dw#4 -- vwuz1=_hi_vduz2 @@ -8416,6 +8435,7 @@ print_dword: { } //SEG241 print_word // Print a word as HEX +// print_word(word zeropage(3) w) print_word: { .label w = 3 //SEG242 [110] (byte) print_byte::b#0 ← > (word) print_word::w#5 -- vbuxx=_hi_vwuz1 @@ -8447,6 +8467,7 @@ print_word: { } //SEG255 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG256 [116] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -8486,6 +8507,7 @@ print_byte: { } //SEG271 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG272 [124] *((byte*) print_char_cursor#84) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa ldy #0 @@ -8503,6 +8525,7 @@ print_char: { } //SEG276 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(3) w) print_sword: { .label w = 3 //SEG277 [128] if((signed word) print_sword::w#3>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -8557,6 +8580,7 @@ print_sword: { //SEG297 mulf16s // Fast multiply two signed words to a signed double word result // Fixes offsets introduced by using unsigned multiplication +// mulf16s(signed word zeropage(3) a, signed word zeropage(5) b) mulf16s: { .label _5 = 3 .label _6 = 9 @@ -8671,6 +8695,7 @@ mulf16s: { //SEG328 mulf16u // Fast multiply two unsigned words to a double word result // Done in assembler to utilize fast addition A+X +// mulf16u(word zeropage($15) a, word zeropage($17) b) mulf16u: { .label memA = $f8 .label memB = $fa @@ -8799,6 +8824,7 @@ mulf16u: { //SEG335 mul16s // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage(3) a, signed word zeropage(5) b) mul16s: { .label _5 = 3 .label _6 = 9 @@ -8912,6 +8938,7 @@ mul16s: { } //SEG366 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage(9) a, word zeropage($17) b) mul16u: { .label mb = $11 .label a = 9 @@ -9001,6 +9028,7 @@ mul16u: { //SEG390 muls16s // Slow multiplication of signed words // Perform a signed multiplication by repeated addition/subtraction +// muls16s(signed word zeropage(3) a, signed word zeropage(5) b) muls16s: { .label m = $b .label j = 9 @@ -9432,6 +9460,7 @@ mul16u_compare: { str1: .text "word multiply results match!@" } //SEG524 mul16u_error +// mul16u_error(word zeropage(3) a, word zeropage($17) b, dword zeropage($b) ms, dword zeropage($19) mn, dword zeropage($11) mf) mul16u_error: { .label a = 3 .label b = $17 @@ -9607,6 +9636,7 @@ mul16u_error: { //SEG591 muls16u // Slow multiplication of unsigned words // Calculate an unsigned multiplication by repeated addition +// muls16u(word zeropage($15) a, word zeropage($17) b) muls16u: { .label return = $b .label m = $b @@ -10354,7 +10384,7 @@ Removing unreachable instruction jmp b4 Removing unreachable instruction jmp b4 Succesful ASM optimization Pass5UnreachableCodeElimination Fixing long branch [110] bne b1 to beq -Fixing long branch [850] bne b1 to beq +Fixing long branch [863] bne b1 to beq FINAL SYMBOL TABLE (label) @40 @@ -11107,6 +11137,7 @@ print_ln: { } //SEG132 print_str // Print a zero-terminated string +// print_str(byte* zeropage(9) str) print_str: { .label str = 9 //SEG133 [65] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -11141,6 +11172,7 @@ print_str: { jmp b1 } //SEG144 mul16s_error +// mul16s_error(signed word zeropage(3) a, signed word zeropage(5) b, signed dword zeropage($b) ms, signed dword zeropage($19) mn, signed dword zeropage($11) mf) mul16s_error: { .label a = 3 .label b = 5 @@ -11268,6 +11300,7 @@ mul16s_error: { } //SEG206 print_sdword // Print a signed dword as HEX +// print_sdword(signed dword zeropage($b) dw) print_sdword: { .label dw = $b //SEG207 [95] if((signed dword) print_sdword::dw#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sdword::@1 -- vdsz1_ge_0_then_la1 @@ -11317,6 +11350,7 @@ print_sdword: { } //SEG227 print_dword // Print a dword as HEX +// print_dword(dword zeropage($b) dw) print_dword: { .label dw = $b //SEG228 [104] (word) print_word::w#1 ← > (dword) print_dword::dw#4 -- vwuz1=_hi_vduz2 @@ -11346,6 +11380,7 @@ print_dword: { } //SEG241 print_word // Print a word as HEX +// print_word(word zeropage(3) w) print_word: { .label w = 3 //SEG242 [110] (byte) print_byte::b#0 ← > (word) print_word::w#5 -- vbuxx=_hi_vwuz1 @@ -11371,6 +11406,7 @@ print_word: { } //SEG255 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG256 [116] (byte~) print_byte::$0 ← (byte) print_byte::b#2 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -11404,6 +11440,7 @@ print_byte: { } //SEG271 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG272 [124] *((byte*) print_char_cursor#84) ← (byte) print_char::ch#4 -- _deref_pbuz1=vbuaa ldy #0 @@ -11419,6 +11456,7 @@ print_char: { } //SEG276 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(3) w) print_sword: { .label w = 3 //SEG277 [128] if((signed word) print_sword::w#3>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -11461,6 +11499,7 @@ print_sword: { //SEG297 mulf16s // Fast multiply two signed words to a signed double word result // Fixes offsets introduced by using unsigned multiplication +// mulf16s(signed word zeropage(3) a, signed word zeropage(5) b) mulf16s: { .label _5 = 3 .label _6 = 9 @@ -11560,6 +11599,7 @@ mulf16s: { //SEG328 mulf16u // Fast multiply two unsigned words to a double word result // Done in assembler to utilize fast addition A+X +// mulf16u(word zeropage($15) a, word zeropage($17) b) mulf16u: { .label memA = $f8 .label memB = $fa @@ -11686,6 +11726,7 @@ mulf16u: { //SEG335 mul16s // Multiply of two signed words to a signed double word // Fixes offsets introduced by using unsigned multiplication +// mul16s(signed word zeropage(3) a, signed word zeropage(5) b) mul16s: { .label _5 = 3 .label _6 = 9 @@ -11784,6 +11825,7 @@ mul16s: { } //SEG366 mul16u // Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word +// mul16u(word zeropage(9) a, word zeropage($17) b) mul16u: { .label mb = $11 .label a = 9 @@ -11861,6 +11903,7 @@ mul16u: { //SEG390 muls16s // Slow multiplication of signed words // Perform a signed multiplication by repeated addition/subtraction +// muls16s(signed word zeropage(3) a, signed word zeropage(5) b) muls16s: { .label m = $b .label j = 9 @@ -12222,6 +12265,7 @@ mul16u_compare: { str1: .text "word multiply results match!@" } //SEG524 mul16u_error +// mul16u_error(word zeropage(3) a, word zeropage($17) b, dword zeropage($b) ms, dword zeropage($19) mn, dword zeropage($11) mf) mul16u_error: { .label a = 3 .label b = $17 @@ -12359,6 +12403,7 @@ mul16u_error: { //SEG591 muls16u // Slow multiplication of unsigned words // Calculate an unsigned multiplication by repeated addition +// muls16u(word zeropage($15) a, word zeropage($17) b) muls16u: { .label return = $b .label m = $b diff --git a/src/test/ref/test-multiply-8bit.asm b/src/test/ref/test-multiply-8bit.asm index 7d3013a5e..590bcc04d 100644 --- a/src/test/ref/test-multiply-8bit.asm +++ b/src/test/ref/test-multiply-8bit.asm @@ -108,6 +108,7 @@ print_ln: { rts } // Print a zero-terminated string +// print_str(byte* zeropage(6) str) print_str: { .label str = 6 b1: @@ -130,6 +131,7 @@ print_str: { !: jmp b1 } +// mul8s_error(signed byte register(X) a, signed byte zeropage(3) b, signed word zeropage(8) ms, signed word zeropage($c) mn, signed word zeropage($e) mf) mul8s_error: { .label b = 3 .label ms = 8 @@ -187,6 +189,7 @@ mul8s_error: { str4: .text " / fast:@" } // Print a signed word as HEX +// print_sword(signed word zeropage(8) w) print_sword: { .label w = 8 lda w+1 @@ -207,6 +210,7 @@ print_sword: { rts } // Print a word as HEX +// print_word(word zeropage(8) w) print_word: { .label w = 8 lda w+1 @@ -218,6 +222,7 @@ print_word: { rts } // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { txa lsr @@ -235,6 +240,7 @@ print_byte: { rts } // Print a single char +// print_char(byte register(A) ch) print_char: { ldy #0 sta (print_char_cursor),y @@ -245,6 +251,7 @@ print_char: { rts } // Print a signed byte as HEX +// print_sbyte(signed byte register(X) b) print_sbyte: { cpx #0 bmi b1 @@ -265,6 +272,7 @@ print_sbyte: { } // Multiply of two signed bytes to a signed word // Fixes offsets introduced by using unsigned multiplication +// mul8s(signed byte zeropage(2) a, signed byte register(Y) b) mul8s: { .label m = $c .label a = 2 @@ -291,6 +299,7 @@ mul8s: { rts } // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = 6 .label res = $c @@ -325,6 +334,7 @@ mul8u: { jmp b1 } // Fast multiply two signed bytes to a word result +// mulf8s(signed byte register(A) a, signed byte register(X) b) mulf8s: { .label return = $e jsr mulf8u_prepare @@ -334,6 +344,7 @@ mulf8s: { } // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8s_prepare(byte a) +// mulf8s_prepared(signed byte zeropage(3) b) mulf8s_prepared: { .label memA = $fd .label m = $e @@ -361,6 +372,7 @@ mulf8s_prepared: { } // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8u_prepare(byte a) +// mulf8u_prepared(byte register(X) b) mulf8u_prepared: { .label resL = $fe .label memB = $ff @@ -384,6 +396,7 @@ mulf8u_prepared: { rts } // Prepare for fast multiply with an unsigned byte to a word result +// mulf8u_prepare(byte register(A) a) mulf8u_prepare: { .label memA = $fd sta memA @@ -396,6 +409,7 @@ mulf8u_prepare: { } // Slow multiplication of signed bytes // Perform a signed multiplication by repeated addition/subtraction +// muls8s(signed byte zeropage(2) a, signed byte register(X) b) muls8s: { .label m = 8 .label return = 8 @@ -526,6 +540,7 @@ mul8u_compare: { jmp breturn str: .text "multiply results match!@" } +// mul8u_error(byte register(X) a, byte zeropage(3) b, word zeropage(8) ms, word zeropage($c) mn, word zeropage($e) mf) mul8u_error: { .label b = 3 .label ms = 8 @@ -579,6 +594,7 @@ mul8u_error: { str4: .text " / fast:@" } // Fast multiply two unsigned bytes to a word result +// mulf8u(byte register(A) a, byte register(X) b) mulf8u: { .label return = $e jsr mulf8u_prepare @@ -587,6 +603,7 @@ mulf8u: { } // Slow multiplication of unsigned bytes // Calculate an unsigned multiplication by repeated addition +// muls8u(byte zeropage(2) a, byte register(X) b) muls8u: { .label return = 8 .label m = 8 diff --git a/src/test/ref/test-multiply-8bit.log b/src/test/ref/test-multiply-8bit.log index 78243490b..a8bbca69d 100644 --- a/src/test/ref/test-multiply-8bit.log +++ b/src/test/ref/test-multiply-8bit.log @@ -5303,6 +5303,7 @@ print_ln: { } //SEG117 print_str // Print a zero-terminated string +// print_str(byte* zeropage(7) str) print_str: { .label str = 7 //SEG118 [64] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -5343,6 +5344,7 @@ print_str: { jmp b1_from_b2 } //SEG129 mul8s_error +// mul8s_error(signed byte zeropage($4e) a, signed byte zeropage($4f) b, signed word zeropage($50) ms, signed word zeropage($52) mn, signed word zeropage($54) mf) mul8s_error: { .label a = $4e .label b = $4f @@ -5509,6 +5511,7 @@ mul8s_error: { } //SEG192 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(9) w) print_sword: { .label w = 9 //SEG193 [94] if((signed word) print_sword::w#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -5567,6 +5570,7 @@ print_sword: { } //SEG213 print_word // Print a word as HEX +// print_word(word zeropage($b) w) print_word: { .label w = $b //SEG214 [103] (byte) print_byte::b#1 ← > (word) print_word::w#6 -- vbuz1=_hi_vwuz2 @@ -5598,6 +5602,7 @@ print_word: { } //SEG227 print_byte // Print a byte as HEX +// print_byte(byte zeropage($d) b) print_byte: { .label _0 = $56 .label _2 = $57 @@ -5644,6 +5649,7 @@ print_byte: { } //SEG243 print_char // Print a single char +// print_char(byte zeropage($e) ch) print_char: { .label ch = $e //SEG244 [117] *((byte*) print_char_cursor#84) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuz2 @@ -5663,6 +5669,7 @@ print_char: { } //SEG248 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte zeropage($11) b) print_sbyte: { .label b = $11 //SEG249 [121] if((signed byte) print_sbyte::b#3<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsz1_lt_0_then_la1 @@ -5729,6 +5736,7 @@ print_sbyte: { //SEG274 mul8s // Multiply of two signed bytes to a signed word // Fixes offsets introduced by using unsigned multiplication +// mul8s(signed byte zeropage($48) a, signed byte zeropage($49) b) mul8s: { .label _5 = $5a .label _6 = $5b @@ -5829,6 +5837,7 @@ mul8s: { } //SEG304 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte zeropage($15) a, byte zeropage($14) b) mul8u: { .label _1 = $60 .label mb = $18 @@ -5905,6 +5914,7 @@ mul8u: { } //SEG328 mulf8s // Fast multiply two signed bytes to a word result +// mulf8s(signed byte zeropage($42) a, signed byte zeropage($43) b) mulf8s: { .label return = $64 .label a = $42 @@ -5951,6 +5961,7 @@ mulf8s: { //SEG342 mulf8s_prepared // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8s_prepare(byte a) +// mulf8s_prepared(signed byte zeropage($61) b) mulf8s_prepared: { .label memA = $fd .label _4 = $68 @@ -6048,6 +6059,7 @@ mulf8s_prepared: { //SEG370 mulf8u_prepared // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8u_prepare(byte a) +// mulf8u_prepared(byte zeropage($1c) b) mulf8u_prepared: { .label resL = $fe .label memB = $ff @@ -6084,6 +6096,7 @@ mulf8u_prepared: { } //SEG376 mulf8u_prepare // Prepare for fast multiply with an unsigned byte to a word result +// mulf8u_prepare(byte zeropage($1d) a) mulf8u_prepare: { .label memA = $fd .label a = $1d @@ -6106,6 +6119,7 @@ mulf8u_prepare: { //SEG381 muls8s // Slow multiplication of signed bytes // Perform a signed multiplication by repeated addition/subtraction +// muls8s(signed byte zeropage($3c) a, signed byte zeropage($3d) b) muls8s: { .label m = $1f .label j = $1e @@ -6463,6 +6477,7 @@ mul8u_compare: { str: .text "multiply results match!@" } //SEG490 mul8u_error +// mul8u_error(byte zeropage($80) a, byte zeropage($81) b, word zeropage($82) ms, word zeropage($84) mn, word zeropage($86) mf) mul8u_error: { .label a = $80 .label b = $81 @@ -6629,6 +6644,7 @@ mul8u_error: { } //SEG557 mulf8u // Fast multiply two unsigned bytes to a word result +// mulf8u(byte zeropage($76) a, byte zeropage($77) b) mulf8u: { .label return = $8a .label a = $76 @@ -6675,6 +6691,7 @@ mulf8u: { //SEG572 muls8u // Slow multiplication of unsigned bytes // Calculate an unsigned multiplication by repeated addition +// muls8u(byte zeropage($70) a, byte zeropage($71) b) muls8u: { .label return = $26 .label m = $26 @@ -8058,6 +8075,7 @@ print_ln: { } //SEG117 print_str // Print a zero-terminated string +// print_str(byte* zeropage(6) str) print_str: { .label str = 6 //SEG118 [64] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -8098,6 +8116,7 @@ print_str: { jmp b1_from_b2 } //SEG129 mul8s_error +// mul8s_error(signed byte register(X) a, signed byte zeropage(3) b, signed word zeropage(8) ms, signed word zeropage($c) mn, signed word zeropage($e) mf) mul8s_error: { .label b = 3 .label ms = 8 @@ -8256,6 +8275,7 @@ mul8s_error: { } //SEG192 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(8) w) print_sword: { .label w = 8 //SEG193 [94] if((signed word) print_sword::w#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -8309,6 +8329,7 @@ print_sword: { } //SEG213 print_word // Print a word as HEX +// print_word(word zeropage(8) w) print_word: { .label w = 8 //SEG214 [103] (byte) print_byte::b#1 ← > (word) print_word::w#6 -- vbuxx=_hi_vwuz1 @@ -8340,6 +8361,7 @@ print_word: { } //SEG227 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG228 [109] (byte~) print_byte::$0 ← (byte) print_byte::b#5 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -8379,6 +8401,7 @@ print_byte: { } //SEG243 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG244 [117] *((byte*) print_char_cursor#84) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuaa ldy #0 @@ -8396,6 +8419,7 @@ print_char: { } //SEG248 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte register(X) b) print_sbyte: { //SEG249 [121] if((signed byte) print_sbyte::b#3<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsxx_lt_0_then_la1 cpx #0 @@ -8457,6 +8481,7 @@ print_sbyte: { //SEG274 mul8s // Multiply of two signed bytes to a signed word // Fixes offsets introduced by using unsigned multiplication +// mul8s(signed byte zeropage(2) a, signed byte register(Y) b) mul8s: { .label m = $c .label a = 2 @@ -8530,6 +8555,7 @@ mul8s: { } //SEG304 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = 6 .label res = $c @@ -8600,6 +8626,7 @@ mul8u: { } //SEG328 mulf8s // Fast multiply two signed bytes to a word result +// mulf8s(signed byte register(A) a, signed byte register(X) b) mulf8s: { .label return = $e jmp mulf8s_prepare1 @@ -8632,6 +8659,7 @@ mulf8s: { //SEG342 mulf8s_prepared // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8s_prepare(byte a) +// mulf8s_prepared(signed byte zeropage(3) b) mulf8s_prepared: { .label memA = $fd .label m = $e @@ -8704,6 +8732,7 @@ mulf8s_prepared: { //SEG370 mulf8u_prepared // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8u_prepare(byte a) +// mulf8u_prepared(byte register(X) b) mulf8u_prepared: { .label resL = $fe .label memB = $ff @@ -8736,6 +8765,7 @@ mulf8u_prepared: { } //SEG376 mulf8u_prepare // Prepare for fast multiply with an unsigned byte to a word result +// mulf8u_prepare(byte register(A) a) mulf8u_prepare: { .label memA = $fd //SEG377 [191] *((const byte*) mulf8u_prepare::memA#0) ← (byte) mulf8u_prepare::a#2 -- _deref_pbuc1=vbuaa @@ -8756,6 +8786,7 @@ mulf8u_prepare: { //SEG381 muls8s // Slow multiplication of signed bytes // Perform a signed multiplication by repeated addition/subtraction +// muls8s(signed byte zeropage(2) a, signed byte register(X) b) muls8s: { .label m = 8 .label return = 8 @@ -9056,6 +9087,7 @@ mul8u_compare: { str: .text "multiply results match!@" } //SEG490 mul8u_error +// mul8u_error(byte register(X) a, byte zeropage(3) b, word zeropage(8) ms, word zeropage($c) mn, word zeropage($e) mf) mul8u_error: { .label b = 3 .label ms = 8 @@ -9214,6 +9246,7 @@ mul8u_error: { } //SEG557 mulf8u // Fast multiply two unsigned bytes to a word result +// mulf8u(byte register(A) a, byte register(X) b) mulf8u: { .label return = $e //SEG558 [270] (byte) mulf8u_prepare::a#0 ← (byte) mulf8u::a#0 @@ -9245,6 +9278,7 @@ mulf8u: { //SEG572 muls8u // Slow multiplication of unsigned bytes // Calculate an unsigned multiplication by repeated addition +// muls8u(byte zeropage(2) a, byte register(X) b) muls8u: { .label return = 8 .label m = 8 @@ -11014,6 +11048,7 @@ print_ln: { } //SEG117 print_str // Print a zero-terminated string +// print_str(byte* zeropage(6) str) print_str: { .label str = 6 //SEG118 [64] phi from print_str print_str::@2 to print_str::@1 [phi:print_str/print_str::@2->print_str::@1] @@ -11048,6 +11083,7 @@ print_str: { jmp b1 } //SEG129 mul8s_error +// mul8s_error(signed byte register(X) a, signed byte zeropage(3) b, signed word zeropage(8) ms, signed word zeropage($c) mn, signed word zeropage($e) mf) mul8s_error: { .label b = 3 .label ms = 8 @@ -11168,6 +11204,7 @@ mul8s_error: { } //SEG192 print_sword // Print a signed word as HEX +// print_sword(signed word zeropage(8) w) print_sword: { .label w = 8 //SEG193 [94] if((signed word) print_sword::w#4>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sword::@1 -- vwsz1_ge_0_then_la1 @@ -11209,6 +11246,7 @@ print_sword: { } //SEG213 print_word // Print a word as HEX +// print_word(word zeropage(8) w) print_word: { .label w = 8 //SEG214 [103] (byte) print_byte::b#1 ← > (word) print_word::w#6 -- vbuxx=_hi_vwuz1 @@ -11234,6 +11272,7 @@ print_word: { } //SEG227 print_byte // Print a byte as HEX +// print_byte(byte register(X) b) print_byte: { //SEG228 [109] (byte~) print_byte::$0 ← (byte) print_byte::b#5 >> (byte/signed byte/word/signed word/dword/signed dword) 4 -- vbuaa=vbuxx_ror_4 txa @@ -11267,6 +11306,7 @@ print_byte: { } //SEG243 print_char // Print a single char +// print_char(byte register(A) ch) print_char: { //SEG244 [117] *((byte*) print_char_cursor#84) ← (byte) print_char::ch#5 -- _deref_pbuz1=vbuaa ldy #0 @@ -11282,6 +11322,7 @@ print_char: { } //SEG248 print_sbyte // Print a signed byte as HEX +// print_sbyte(signed byte register(X) b) print_sbyte: { //SEG249 [121] if((signed byte) print_sbyte::b#3<(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 -- vbsxx_lt_0_then_la1 cpx #0 @@ -11328,6 +11369,7 @@ print_sbyte: { //SEG274 mul8s // Multiply of two signed bytes to a signed word // Fixes offsets introduced by using unsigned multiplication +// mul8s(signed byte zeropage(2) a, signed byte register(Y) b) mul8s: { .label m = $c .label a = 2 @@ -11384,6 +11426,7 @@ mul8s: { } //SEG304 mul8u // Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word +// mul8u(byte register(X) a, byte register(A) b) mul8u: { .label mb = 6 .label res = $c @@ -11442,6 +11485,7 @@ mul8u: { } //SEG328 mulf8s // Fast multiply two signed bytes to a word result +// mulf8s(signed byte register(A) a, signed byte register(X) b) mulf8s: { .label return = $e //SEG329 mulf8s::mulf8s_prepare1 @@ -11465,6 +11509,7 @@ mulf8s: { //SEG342 mulf8s_prepared // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8s_prepare(byte a) +// mulf8s_prepared(signed byte zeropage(3) b) mulf8s_prepared: { .label memA = $fd .label m = $e @@ -11520,6 +11565,7 @@ mulf8s_prepared: { //SEG370 mulf8u_prepared // Calculate fast multiply with a prepared unsigned byte to a word result // The prepared number is set by calling mulf8u_prepare(byte a) +// mulf8u_prepared(byte register(X) b) mulf8u_prepared: { .label resL = $fe .label memB = $ff @@ -11549,6 +11595,7 @@ mulf8u_prepared: { } //SEG376 mulf8u_prepare // Prepare for fast multiply with an unsigned byte to a word result +// mulf8u_prepare(byte register(A) a) mulf8u_prepare: { .label memA = $fd //SEG377 [191] *((const byte*) mulf8u_prepare::memA#0) ← (byte) mulf8u_prepare::a#2 -- _deref_pbuc1=vbuaa @@ -11566,6 +11613,7 @@ mulf8u_prepare: { //SEG381 muls8s // Slow multiplication of signed bytes // Perform a signed multiplication by repeated addition/subtraction +// muls8s(signed byte zeropage(2) a, signed byte register(X) b) muls8s: { .label m = 8 .label return = 8 @@ -11805,6 +11853,7 @@ mul8u_compare: { str: .text "multiply results match!@" } //SEG490 mul8u_error +// mul8u_error(byte register(X) a, byte zeropage(3) b, word zeropage(8) ms, word zeropage($c) mn, word zeropage($e) mf) mul8u_error: { .label b = 3 .label ms = 8 @@ -11925,6 +11974,7 @@ mul8u_error: { } //SEG557 mulf8u // Fast multiply two unsigned bytes to a word result +// mulf8u(byte register(A) a, byte register(X) b) mulf8u: { .label return = $e //SEG558 [270] (byte) mulf8u_prepare::a#0 ← (byte) mulf8u::a#0 @@ -11948,6 +11998,7 @@ mulf8u: { //SEG572 muls8u // Slow multiplication of unsigned bytes // Calculate an unsigned multiplication by repeated addition +// muls8u(byte zeropage(2) a, byte register(X) b) muls8u: { .label return = 8 .label m = 8 diff --git a/src/test/ref/var-register.asm b/src/test/ref/var-register.asm index d7cc57027..8d39dc69d 100644 --- a/src/test/ref/var-register.asm +++ b/src/test/ref/var-register.asm @@ -26,6 +26,7 @@ main: { bne b1 rts } +// print(byte register(X) idx, byte register(A) val) print: { .label SCREEN = $400 sta SCREEN,x diff --git a/src/test/ref/var-register.log b/src/test/ref/var-register.log index 7cf4ccde8..73079868b 100644 --- a/src/test/ref/var-register.log +++ b/src/test/ref/var-register.log @@ -372,6 +372,7 @@ main: { rts } //SEG41 print +// print(byte register(X) idx, byte zeropage(4) val) print: { .label SCREEN = $400 .label val = 4 @@ -511,6 +512,7 @@ main: { rts } //SEG41 print +// print(byte register(X) idx, byte register(A) val) print: { .label SCREEN = $400 //SEG42 [19] *((const byte*) print::SCREEN#0 + (byte) print::idx#0) ← (byte) print::val#0 -- pbuc1_derefidx_vbuxx=vbuaa @@ -678,6 +680,7 @@ main: { rts } //SEG41 print +// print(byte register(X) idx, byte register(A) val) print: { .label SCREEN = $400 //SEG42 [19] *((const byte*) print::SCREEN#0 + (byte) print::idx#0) ← (byte) print::val#0 -- pbuc1_derefidx_vbuxx=vbuaa diff --git a/src/test/ref/voronoi.asm b/src/test/ref/voronoi.asm index 5f29834ea..ea561c3d7 100644 --- a/src/test/ref/voronoi.asm +++ b/src/test/ref/voronoi.asm @@ -106,6 +106,7 @@ render: { bne b1 rts } +// findcol(byte zeropage(5) x, byte zeropage(2) y) findcol: { .label x = 5 .label y = 2 diff --git a/src/test/ref/voronoi.log b/src/test/ref/voronoi.log index 531e1fc5c..92e9e4983 100644 --- a/src/test/ref/voronoi.log +++ b/src/test/ref/voronoi.log @@ -1475,6 +1475,7 @@ render: { rts } //SEG87 findcol +// findcol(byte zeropage($14) x, byte zeropage($15) y) findcol: { .label _8 = $1a .label _10 = $1b @@ -2074,6 +2075,7 @@ render: { rts } //SEG87 findcol +// findcol(byte zeropage(5) x, byte zeropage(2) y) findcol: { .label x = 5 .label y = 2 @@ -2717,6 +2719,7 @@ render: { rts } //SEG87 findcol +// findcol(byte zeropage(5) x, byte zeropage(2) y) findcol: { .label x = 5 .label y = 2 diff --git a/src/test/ref/zpparammin.asm b/src/test/ref/zpparammin.asm index 7a03fddce..857c6eff7 100644 --- a/src/test/ref/zpparammin.asm +++ b/src/test/ref/zpparammin.asm @@ -33,6 +33,7 @@ main: { bne b1 rts } +// sum2(byte register(Y) a, byte register(A) b, byte register(X) c) sum2: { sty $ff clc @@ -42,6 +43,7 @@ sum2: { adc $ff rts } +// sum(byte register(Y) a, byte register(A) b, byte register(X) c) sum: { sty $ff clc diff --git a/src/test/ref/zpparammin.log b/src/test/ref/zpparammin.log index c81e7e85a..80cb471e7 100644 --- a/src/test/ref/zpparammin.log +++ b/src/test/ref/zpparammin.log @@ -469,6 +469,7 @@ main: { rts } //SEG36 sum2 +// sum2(byte zeropage($a) a, byte zeropage(8) b, byte zeropage(9) c) sum2: { .label _0 = $d .label a = $a @@ -493,6 +494,7 @@ sum2: { rts } //SEG41 sum +// sum(byte zeropage(5) a, byte zeropage(3) b, byte zeropage(4) c) sum: { .label _0 = $f .label a = 5 @@ -661,6 +663,7 @@ main: { rts } //SEG36 sum2 +// sum2(byte register(Y) a, byte register(A) b, byte register(X) c) sum2: { //SEG37 [23] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 -- vbuaa=vbuyy_plus_vbuaa sty $ff @@ -677,6 +680,7 @@ sum2: { rts } //SEG41 sum +// sum(byte register(Y) a, byte register(A) b, byte register(X) c) sum: { //SEG42 [26] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 -- vbuaa=vbuyy_plus_vbuaa sty $ff @@ -864,6 +868,7 @@ main: { rts } //SEG36 sum2 +// sum2(byte register(Y) a, byte register(A) b, byte register(X) c) sum2: { //SEG37 [23] (byte~) sum2::$0 ← (byte) sum2::a#0 + (byte) sum2::b#0 -- vbuaa=vbuyy_plus_vbuaa sty $ff @@ -878,6 +883,7 @@ sum2: { rts } //SEG41 sum +// sum(byte register(Y) a, byte register(A) b, byte register(X) c) sum: { //SEG42 [26] (byte~) sum::$0 ← (byte) sum::a#0 + (byte) sum::b#0 -- vbuaa=vbuyy_plus_vbuaa sty $ff diff --git a/src/test/script/update-ref.sh b/src/test/script/update-ref.sh index f1b75f269..35df30731 100755 --- a/src/test/script/update-ref.sh +++ b/src/test/script/update-ref.sh @@ -3,6 +3,11 @@ # Usage: update-ref export REF_HOME="$(dirname $0)/../ref" export UPD_HOME=$1 +echo References ${REF_HOME} +echo Updates ${UPD_HOME} +rm ${UPD_HOME}/update.sh pushd ${UPD_HOME} -for i in $(find . -type f | grep -v '/bin/'); do echo ${i}; cp ${i} ${REF_HOME}/${i}; done +for i in $(find . -type f | grep -v '/bin/'); do echo cp ${UPD_HOME}/${i} ${REF_HOME}/${i} >> update.sh; done popd +source ${UPD_HOME}/update.sh +