use split word arrays in various examples

This commit is contained in:
Irmen de Jong 2023-05-28 13:51:58 +02:00
parent 39eda67867
commit 4a00a5ba9e
8 changed files with 18 additions and 66 deletions

View File

@ -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
ldy #>f1
jsr MOVFM ; load FAC1
lda #<f2
ldy #>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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 ]

View File

@ -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

View File

@ -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,

View File

@ -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