From 4a00a5ba9ea6e6443e1091d9f79971de42bd4cec Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sun, 28 May 2023 13:51:58 +0200 Subject: [PATCH] use split word arrays in various examples --- examples/c128floatproblem.asm | 48 --------------------------------- examples/cube3d-gfx.p8 | 6 ++--- examples/cube3d-sprites.p8 | 6 ++--- examples/cube3d.p8 | 6 ++--- examples/cx16/cobramk3-gfx.p8 | 6 ++--- examples/cx16/cube3d.p8 | 6 ++--- examples/cx16/pcmaudio/adpcm.p8 | 2 +- examples/vm/bouncegfx.p8 | 4 +-- 8 files changed, 18 insertions(+), 66 deletions(-) delete mode 100644 examples/c128floatproblem.asm diff --git a/examples/c128floatproblem.asm b/examples/c128floatproblem.asm deleted file mode 100644 index cbc360116..000000000 --- a/examples/c128floatproblem.asm +++ /dev/null @@ -1,48 +0,0 @@ - -; this program adds 2 floats 1.2345 + 4.4444 and prints the result 5.67879 -; it works fine on C64 and CX16 but fails to add the right number on C128 -; I think it has something to do with the banking on the C128 -; because several rom fp routines mention "value in bank 1" -; but I don't know what this means and why the program as given doesn't work - -.cpu '6502' - -* = $1300 ; sys 4864 - -P8ZP_SCRATCH_W1 = 251 ; free zp word -CHROUT = $ffd2 - -; c128: -MOVFM = $af63 -FADD = $af18 -FOUT = $af06 - -;cx16: -;MOVFM = $fe42 -;FADD = $fe12 -;FOUT = $fe7b - -;c64: -;MOVFM = $bba2 -;FADD = $b867 -;FOUT = $bddd - - lda #f1 - jsr MOVFM ; load FAC1 - lda #f2 - jsr FADD ; add mem float to FAC1 DOESN'T WORK ON C128!? - jsr FOUT ; convert to string - sta P8ZP_SCRATCH_W1 - sty P8ZP_SCRATCH_W1+1 - ldy #0 -_printloop lda (P8ZP_SCRATCH_W1),y - beq _done - jsr CHROUT - iny - bne _printloop -_done jmp _done - -f1 .byte $81, $1e, $04, $18, $93 ; float 1.2345 -f2 .byte $83, $0e, $38, $86, $59 ; float 4.4444 diff --git a/examples/cube3d-gfx.p8 b/examples/cube3d-gfx.p8 index 13a23b2a3..abf5bfff6 100644 --- a/examples/cube3d-gfx.p8 +++ b/examples/cube3d-gfx.p8 @@ -7,9 +7,9 @@ main { ; vertices - word[] xcoor = [ -100, -100, -100, -100, 100, 100, 100, 100 ] - word[] ycoor = [ -100, -100, 100, 100, -100, -100, 100, 100 ] - word[] zcoor = [ -100, 100, -100, 100, -100, 100, -100, 100 ] + word[] @split xcoor = [ -100, -100, -100, -100, 100, 100, 100, 100 ] + word[] @split ycoor = [ -100, -100, 100, 100, -100, -100, 100, 100 ] + word[] @split zcoor = [ -100, 100, -100, 100, -100, 100, -100, 100 ] ; storage for rotated coordinates word[len(xcoor)] rotatedx diff --git a/examples/cube3d-sprites.p8 b/examples/cube3d-sprites.p8 index 6c2aac5f8..772d88f15 100644 --- a/examples/cube3d-sprites.p8 +++ b/examples/cube3d-sprites.p8 @@ -67,9 +67,9 @@ main { const uword height = 200 ; vertices - word[] xcoor = [ -100, -100, -100, -100, 100, 100, 100, 100 ] - word[] ycoor = [ -100, -100, 100, 100, -100, -100, 100, 100 ] - word[] zcoor = [ -100, 100, -100, 100, -100, 100, -100, 100 ] + word[] @split xcoor = [ -100, -100, -100, -100, 100, 100, 100, 100 ] + word[] @split ycoor = [ -100, -100, 100, 100, -100, -100, 100, 100 ] + word[] @split zcoor = [ -100, 100, -100, 100, -100, 100, -100, 100 ] ; storage for rotated coordinates word[len(xcoor)] rotatedx diff --git a/examples/cube3d.p8 b/examples/cube3d.p8 index 96945e45b..2d680babf 100644 --- a/examples/cube3d.p8 +++ b/examples/cube3d.p8 @@ -7,9 +7,9 @@ main { ; vertices - word[] xcoor = [ -40, -40, -40, -40, 40, 40, 40, 40 ] - word[] ycoor = [ -40, -40, 40, 40, -40, -40, 40, 40 ] - word[] zcoor = [ -40, 40, -40, 40, -40, 40, -40, 40 ] + word[] @split xcoor = [ -40, -40, -40, -40, 40, 40, 40, 40 ] + word[] @split ycoor = [ -40, -40, 40, 40, -40, -40, 40, 40 ] + word[] @split zcoor = [ -40, 40, -40, 40, -40, 40, -40, 40 ] ; storage for rotated coordinates word[len(xcoor)] rotatedx diff --git a/examples/cx16/cobramk3-gfx.p8 b/examples/cx16/cobramk3-gfx.p8 index 77322dd2e..533cd1612 100644 --- a/examples/cx16/cobramk3-gfx.p8 +++ b/examples/cx16/cobramk3-gfx.p8 @@ -228,9 +228,9 @@ const ubyte totalNumberOfFaces = 22 const ubyte totalNumberOfPoints = 34 str shipName = "cobra-mk3" ; vertices -word[totalNumberOfPoints] xcoor = [ 32,-32,0,-120,120,-88,88,128,-128,0,-32,32,-36,-8,8,36,36,8,-8,-36,-1,-1,-80,-80,-88,80,88,80,1,1,1,1,-1,-1 ] -word[totalNumberOfPoints] ycoor = [ 0,0,26,-3,-3,16,16,-8,-8,26,-24,-24,8,12,12,8,-12,-16,-16,-12,-1,-1,-6,6,0,6,0,-6,-1,-1,1,1,1,1 ] -word[totalNumberOfPoints] zcoor = [ 76,76,24,-8,-8,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,76,90,-40,-40,-40,-40,-40,-40,76,90,76,90,76,90 ] +word[totalNumberOfPoints] @split xcoor = [ 32,-32,0,-120,120,-88,88,128,-128,0,-32,32,-36,-8,8,36,36,8,-8,-36,-1,-1,-80,-80,-88,80,88,80,1,1,1,1,-1,-1 ] +word[totalNumberOfPoints] @split ycoor = [ 0,0,26,-3,-3,16,16,-8,-8,26,-24,-24,8,12,12,8,-12,-16,-16,-12,-1,-1,-6,6,0,6,0,-6,-1,-1,1,1,1,1 ] +word[totalNumberOfPoints] @split zcoor = [ 76,76,24,-8,-8,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,76,90,-40,-40,-40,-40,-40,-40,76,90,76,90,76,90 ] ; edges and faces ubyte[totalNumberOfEdges] edgesFrom = [ 0,1,0,10,1,0,2,0,4,0,4,7,2,1,1,3,8,3,2,5,6,5,6,16,15,14,14,18,13,12,12,26,25,25,22,23,22,20,28,21,20,28,29,30,31,30,32,20,21,20,20 ] ubyte[totalNumberOfEdges] edgesTo = [ 1,2,2,11,10,11,6,6,6,4,7,11,5,5,3,5,10,8,9,9,9,8,7,17,16,15,17,19,18,13,19,27,26,27,23,24,24,28,29,29,21,30,31,31,33,32,33,32,33,33,29 ] diff --git a/examples/cx16/cube3d.p8 b/examples/cx16/cube3d.p8 index 2addea193..3de759995 100644 --- a/examples/cx16/cube3d.p8 +++ b/examples/cx16/cube3d.p8 @@ -4,9 +4,9 @@ main { ; vertices - word[] xcoor = [ -40, -40, -40, -40, 40, 40, 40, 40 ] - word[] ycoor = [ -40, -40, 40, 40, -40, -40, 40, 40 ] - word[] zcoor = [ -40, 40, -40, 40, -40, 40, -40, 40 ] + word[] @split xcoor = [ -40, -40, -40, -40, 40, 40, 40, 40 ] + word[] @split ycoor = [ -40, -40, 40, 40, -40, -40, 40, 40 ] + word[] @split zcoor = [ -40, 40, -40, 40, -40, 40, -40, 40 ] ; storage for rotated coordinates word[len(xcoor)] rotatedx diff --git a/examples/cx16/pcmaudio/adpcm.p8 b/examples/cx16/pcmaudio/adpcm.p8 index a80631b3b..1e06df02d 100644 --- a/examples/cx16/pcmaudio/adpcm.p8 +++ b/examples/cx16/pcmaudio/adpcm.p8 @@ -15,7 +15,7 @@ adpcm { ubyte[] t_index = [ -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8] - uword[] t_step = [ + uword[] @split t_step = [ 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, diff --git a/examples/vm/bouncegfx.p8 b/examples/vm/bouncegfx.p8 index ecf946eda..9ba030fe3 100644 --- a/examples/vm/bouncegfx.p8 +++ b/examples/vm/bouncegfx.p8 @@ -5,8 +5,8 @@ main { sub start() { - word[128] particleX - word[128] particleY + word[128] @split particleX + word[128] @split particleY byte[128] particleDX byte[128] particleDY