Browse Source

Initial commit

master
Thorsten Riess 2 years ago
commit
9d433c0a54
14 changed files with 3703 additions and 0 deletions
  1. 446
    0
      core_00.s
  2. 285
    0
      core_01.s
  3. 162
    0
      core_02.s
  4. 205
    0
      core_03.s
  5. 21
    0
      data_00.s
  6. 446
    0
      data_01.s
  7. 3
    0
      data_02.s
  8. 14
    0
      data_03.s
  9. 1229
    0
      gol3d.s
  10. 683
    0
      polyzoom.s
  11. 34
    0
      systm_00.s
  12. 22
    0
      systm_01.s
  13. 97
    0
      systm_02.s
  14. 56
    0
      systm_03.s

+ 446
- 0
core_00.s View File

@@ -0,0 +1,446 @@
poly_fil:
filxbuf:
move.w no_in,d7
beq fil_end
lea crds_in,a3
subq.w #1,d7
move.w #399,d5
clr.w d6
filbuf1:
lea xbuf,a2
addq.l #2,a2
move.w (a3)+,d0
move.w (a3)+,d1
move.w (a3)+,d2
move.w (a3)+,d3
subq.l #4,a3
cmp.w d5,d1
bge filbuf3
move.w d1,d5
filbuf3:
cmp.w d1,d6
bge filbuf5
move.w d1,d6
filbuf5:
exg.l d5,a5
exg.l d6,a6
clr.w d4
moveq #1,d6
cmp.w d1,d3
beq y_limits
bgt ascend
exg.l d0,d2
exg.l d1,d3
subq.l #2,a2
ascend:
sub.w d1,d3
lsl.w #2,d1
; adda.w d1,a2
lea 0(a2,d1.w),a2
sub.w d0,d2
beq vertical
bgt pos_slope
neg.w d6
neg.w d2
pos_slope:
cmp.w d2,d3
bgt hislope
move.w d2,d5
subq.w #1,d5
add.w d3,d3
move.w d3,d4
neg.w d2
add.w d2,d4
add.w d4,d2
move.w d0,(a2)
inc_x:
add.w d6,d0
tst.w d4
bmi no_stk
addq.l #4,a2
move.w d0,(a2)
add.w d2,d4
bra.s next_x
no_stk:
add.w d3,d4
next_x:
dbra d5,inc_x
bra y_limits
hislope:
move.w d3,d5
subq.w #1,d5
add.w d2,d2
move.w d2,d4
neg.w d3
add.w d3,d4
add.w d4,d3
move.w d0,(a2)
inc_y:
addq.l #4,a2
tst.w d4
bmi same_x
add.w d6,d0
add.w d3,d4
bra.s next_y
same_x:
add.w d2,d4
next_y:
move.w d0,(a2)
dbra d5,inc_y
bra y_limits
vertical:
move.w d0,(a2)
addq.l #4,a2
dbra d3,vertical
y_limits:
exg.l d5,a5
exg.l d6,a6
next_line:
dbra d7,filbuf1
next_poly:
lea xbuf,a1
sub.w d5,d6
move.w d6,d7
beq poly3
move.w d5,d3
lsl.w #2,d5
; adda.w d5,a1
lea 0(a1,d5.w),a1
move.w colour,d4
subq.w #1,d3
poly2:
addq.w #1,d3
move.w (a1)+,d2
move.w (a1)+,d1
sub.w d2,d1
bmi poly4
addq.w #1,d1
movea.l screen,a4
movem.l d0-d7/a0-a6,-(sp)
bsr holine
movem.l (sp)+,d0-d7/a0-a6
poly4:
dbra d7,poly2
poly3:
rts
holine:
lea hln_tbl,a3
lsl.w #2,d3
movea.l 0(a4,d3.w),a4
move.w d2,d5
andi.w #$fff0,d5
lsr.w #1,d5
; adda.w d5,a4
lea 0(a4,d5.w),a4
andi.w #$000f,d2
move.w d2,d0
subi.w #16,d0
neg.w d0
cmp.w d1,d0
bmi long_line
move.w d1,d0
bsr draw_it
rts
long_line:
sub.w d0,d1
bsr draw_it
clr.w d0
not.w d0
move.w d1,d2
lsr.w #4,d2
beq last_word
subi.w #1,d2
move.w d0,d3
not.w d3
move.w #4-1,d5
move.w d4,d6
subq.l #2,a4
inc_plane:
addq.l #2,a4
movea.l a4,a5
move.w d2,d7
lsr.w #1,d6
bcc clr_word
set_word:
or.w d0,(a5)
adda.l #8,a5
dbra d7,set_word
bra new_plane
clr_word:
and.w d3,(a5)
adda.l #8,a5
dbra d7,clr_word
new_plane:
dbra d5,inc_plane
subq.w #6,a5
movea.l a5,a4
last_word:
andi.w #$f,d1
cmpi.w #0,d1
beq holine_end
clr.w d2
move.w d1,d0
bsr draw_it
holine_end:
rts
draw_it:
lsl.w #5,d2
move.w d0,d5
subq.w #1,d5
lsl.w #1,d5
add.w d5,d2
move.w 0(a3,d2.w),d0
move.w d0,d3
not.w d3
moveq #3,d5
move.w d4,d6
next_plane:
lsr.w #1,d6
bcc not_set
or.w d0,(a4)+
dbf d5,next_plane
rts
not_set:
and.w d3,(a4)+
dbf d5,next_plane
fil_end:
rts
poly_point:
movem.l d0-d7/a0-a6,-(sp)
movea.l screen,a0 ; screen address
move.w no_in,d7
subq.w #1,d7
lea crds_in,a1
lea table2,a2
lea pitchmul,a3
lea col_lst,a5
lea vcoordsz,a6 ; for the size
polypt_loop:
moveq #3,d6
move.w (a5)+,d2
move.w (a6)+,d3
move.w (a1)+,d0
move.w (a1)+,d1
polypt_next:
tst.w d1
bmi polypt_cont
tst.w d0
bmi polypt_cont
; clip max
move.w d1,d5
move.w d0,d4
cmpi.w #xmaxpz,d0
bgt polypt_cont
cmpi.w #ymaxpz,d1
bgt polypt_cont
add.w d1,d1
move.w 0(a3,d1.w),d1
lea 0(a0,d1.w),a4
lsl.w #2,d0
move.l 0(a2,d0.w),d0 ; data from table2: d1-low: address offset within line, d1-high: bit-mask for x-position
; color 1 switch plane
tst.w d2
beq.s polyptpln0
addq.w #4,a4
polyptpln0:
addq.w #2,a4
adda.w d0,a4
swap.w d0
or.w d0,(a4)
cmp.w Ooz,d3
bge.s polypt_cont
addi.w #50,d3
;; asr.w #1,d3
move.w d4,d0
move.w d5,d1
cmpi.w #3,d6
blt.s square0
addq.w #1,d1
dbra d6,polypt_next
square0:
cmpi.w #1,d6
beq.s square1
tst.w d6
beq.s polypt_cont
addq.w #1,d0
; tst.w d1
dbra d6,polypt_next
square1:
subq.w #1,d1
dbra d6,polypt_next
polypt_cont:
dbra d7,polypt_loop
movem.l (sp)+,d0-d7/a0-a6
rts
poly_line:
movem.l d0-d7/a0-a6,-(sp)
move.w no_in,d7
beq polyl_end
; lea screen,a0
movea.l screen,a0
; movea.l (a1),a0
; addq.l #4,a0
lea crds_in,a1
subq.w #1,d7
polyl_loop:
; move.w (a1)+,d2
; move.w (a1)+,d3
; movea.w (a1)+,a2
; movea.w (a1)+,a3
; subq.l #4,a1
; movem.l d7/a0/a1,-(sp)
; bsr line
move.w (a1)+,d0
move.w (a1)+,d1
move.w (a1)+,d2
move.w (a1)+,d3
subq.l #4,a1
movem.l d7/a0/a1,-(sp)
; ignore color
; tst.w colour
; beq.s dline
; addq.l #2,a0
dline:
bsr line
;; bsr SL
movem.l (sp)+,d7/a0/a1
dbra d7,polyl_loop
polyl_end:
movem.l (sp)+,d0-d7/a0-a6
rts
lineslow:
; input: d2,d3 (x1,y1) to a2,a3 (x2,y2)
; in color d6, screenaddress at a0
movem.l d7/a1,-(sp)
clr.l d4
movea.w #1,a4
movea.w a4,a5
move.w a2,d6
sub.w d2,d6
bge dxipos
neg.w d6
movea.w #-1,a4
dxipos:
move.w a3,d7
sub.w d3,d7
bgt plotit
beq dyis_0
neg.w d7
movea.w #-1,a5
bra plotit
dyis_0:
not.w d4
plotit:
; tst.w d2
; bmi draw_it2
; tst.w d3
; bmi draw_it2
; cmpi.w #319,d2
; bhi draw_it2
; cmpi.w #199,d3
; bhi draw_it2
move.w d3,d0
; y in d3
; x in d2
movem.l d0-d7/a0-a6,-(sp)
move.w d2,d0
move.w d3,d1
move.w #2,d2
bsr set_pixel
movem.l (sp)+,d0-d7/a0-a6
; lsl.w #2,d0
; movea.l 0(a0,d0.w),a1
; move.w d2,d1
;; for mono
;; lsr.w #3,d1
;; first /16
; lsr.w #4,d1
;; then *8 -> byte address of word in plane
; lsl.w #3,d1
; move.w 0(a1,d1.w),d0
; move.w d2,d5
;;not.w d5
; andi.w #$f,d5
; bset d5,d0
; move.w d0,0(a1,d1.w)
;;move.w d2,d0
;;not.w d0
;;bset d0,0(a1,d1.w)
draw_it2:
cmpa.w d2,a2
bne notend
cmpa.w d3,a3
beq endit
notend:
tst.w d4
bge ystep
xstep:
add.w a4,d2
add.w d7,d4
bra plotit
ystep:
add.w a5,d3
sub.w d6,d4
bra plotit
drawend:
endit:
movem.l (sp)+,d7/a1
rts
set_pixel:
; lea screen,a0
lsl.w #2,d1
movea.l 0(a0,d1.w),a0
move.w d0,d5
andi.w #$fff0,d5
lsr.w #1,d5
lea 0(a0,d5.w),a0
andi.w #$f,d0
subi.w #15,d0
neg.w d0
clr.w d1
bset d0,d1
move.w d1,d3
not.w d3
move.w #4-1,d7
next_planepx:
lsr.w #1,d2
bcc clear_bit
or.w d1,(a0)+
dbra d7,next_planepx
rts
clear_bit:
and.w d3,(a0)+
dbra d7,next_planepx
rts
; .INCLUDE 'POLYZOOM.IS'

+ 285
- 0
core_01.s View File

@@ -0,0 +1,285 @@
no_clip:
bsr clip_ld1
tst.w d7
beq.s cln_end
move.w d7,(a2)
subq.w #1,d7
cln_loop:
move.l (a0)+,(a1)+
dbra d7,cln_loop
cln_end:
rts
clip:
bsr clip_ld1
tst.w d7
beq clip_end
move.w (a0)+,d5
move.w (a0)+,d6
move.w xmin,d0
cmp.w d0,d5
bge xmin_save
bra xmin_update
xmin_next:
move.w (a0)+,d3
move.w (a0)+,d4
move.w d3,d5
move.w d4,d6
sub.w d0,d3
bge xmin_x2in
sub.w d0,d1
blt xmin_update
bsr y_intercept
bra xmin_update
xmin_x2in:
sub.w d0,d1
bge xmin_save
exg.l d1,d3
exg.l d2,d4
bsr y_intercept
xmin_save:
move.w d5,(a1)+
move.w d6,(a1)+
addq.w #1,(a2)
xmin_update:
move.w d5,d1
move.w d6,d2
dbf d7,xmin_next
movea.l a3,a4
subq.l #4,a1
cmpm.l (a4)+,(a1)+
beq xmin_dec
move.l (a3),(a1)
bra clip_xmax
xmin_dec:
tst.w (a2)
beq clip_xmax
subq.w #1,(a2)
clip_xmax:
bsr clip_ld2
tst.w d7
beq clip_ymin
move.w (a0)+,d5
move.w (a0)+,d6
move.w xmax,d0
cmp.w d5,d0
bge xmax_save
bra xmax_update
xmax_next:
move.w (a0)+,d3
move.w (a0)+,d4
move.w d3,d5
move.w d4,d6
sub.w d0,d3
neg.w d3
bge xmax_x2in
sub.w d0,d1
neg.w d1
blt xmax_update
bsr y_intercept
bra xmax_update
xmax_x2in:
sub.w d0,d1
neg.w d1
bge xmax_save
exg.l d1,d3
exg.l d2,d4
bsr y_intercept
xmax_save:
move.w d5,(a1)+
move.w d6,(a1)+
addq.w #1,(a2)
xmax_update:
move.w d5,d1
move.w d6,d2
dbf d7,xmax_next
movea.l a3,a4
subq.l #4,a1
cmpm.l (a4)+,(a1)+
beq xmax_dec
move.l (a3),(a1)
bra clip_ymin
xmax_dec:
tst.w (a2)
beq clip_ymin
subq.w #1,(a2)
clip_ymin:
bsr clip_ld1
tst.w d7
beq clip_ymax
move.w (a0)+,d5
move.w (a0)+,d6
move.w ymin,d0
cmp.w d0,d6
bge ymin_save
bra ymin_update
ymin_next:
move.w (a0)+,d3
move.w (a0)+,d4
move.w d3,d5
move.w d4,d6
sub.w d0,d4
bge ymin_y2in
sub.w d0,d2
blt ymin_update
bsr x_intercept
bra ymin_update
ymin_y2in:
sub.w d0,d2
bge ymin_save
exg.l d1,d3
exg.l d2,d4
bsr x_intercept
ymin_save:
move.w d5,(a1)+
move.w d6,(a1)+
addq.w #1,(a2)
ymin_update:
move.w d5,d1
move.w d6,d2
dbf d7,ymin_next
movea.l a3,a4
subq.l #4,a1
cmpm.l (a4)+,(a1)+
beq ymin_dec
move.l (a3),(a1)
bra clip_ymax
ymin_dec:
tst.w (a2)
beq clip_ymax
subq.w #1,(a2)
clip_ymax:
bsr clip_ld2
tst.w d7
beq clip_end
move.w (a0)+,d5
move.w (a0)+,d6
move.w ymax,d0
cmp.w d6,d0
bge ymax_save
bra ymax_update
ymax_next:
move.w (a0)+,d3
move.w (a0)+,d4
move.w d3,d5
move.w d4,d6
sub.w d0,d4
neg.w d4
bge ymax_y2in
sub.w d0,d2
neg.w d2
blt ymax_update
bsr x_intercept
bra ymax_update
ymax_y2in:
sub.w d0,d2
neg.w d2
bge ymax_save
exg.l d1,d3
exg.l d2,d4
bsr x_intercept
ymax_save:
move.w d5,(a1)+
move.w d6,(a1)+
addq.w #1,(a2)
ymax_update:
move.w d5,d1
move.w d6,d2
dbf d7,ymax_next
movea.l a3,a4
subq.l #4,a1
cmpm.l (a4)+,(a1)+
beq ymax_dec
move.l (a3),(a1)
bra clip_end
ymax_dec:
tst.w (a2)
beq clip_end
subq.w #1,(a2)
clip_end:
rts
clip_ld1:
lea crds_in,a0
lea crds_out,a1
movea.l a1,a3
move.w no_in,d7
lea no_out,a2
clr.w no_out
rts
clip_ld2:
lea crds_out,a0
lea crds_in,a1
movea.l a1,a3
move.w no_out,d7
lea no_in,a2
clr.w no_in
rts
y_intercept:
tst.w d1
beq yint_out
tst.w d3
beq yint_out
movem.w d5/d6,-(sp)
yint_in:
move.w d2,d6
add.w d4,d6
asr.w #1,d6
move.w d1,d5
add.w d3,d5
asr.w #1,d5
beq yint_end
bgt yint_loop
move.w d5,d3
move.w d6,d4
bra yint_in
yint_loop:
move.w d5,d1
move.w d6,d2
bra yint_in
yint_end:
move.w d0,(a1)+
move.w d6,(a1)+
addq.w #1,(a2)
movem.w (sp)+,d5/d6
yint_out:
rts
x_intercept:
tst.w d2
beq xint_out
tst.w d4
beq xint_out
movem.w d5/d6,-(sp)
xint_in:
move.w d1,d5
add.w d3,d5
asr.w #1,d5
move.w d2,d6
add.w d4,d6
asr.w #1,d6
beq xint_end
bgt xint_loop
move.w d6,d4
move.w d5,d3
bra xint_in
xint_loop:
move.w d5,d1
move.w d6,d2
bra xint_in
xint_end:
move.w d5,(a1)+
move.w d0,(a1)+
addq.w #1,(a2)
movem.w (sp)+,d5/d6
xint_out:
rts
.INCLUDE 'CORE_00.IS'

+ 162
- 0
core_02.s View File

@@ -0,0 +1,162 @@
perspective:
move.w vncoords,d7
beq prs_end
subq.w #1,d7
lea vcoordsx,a0
lea vcoordsy,a1
lea vcoordsz,a2
lea scoordsx,a4
lea scoordsy,a5
link a6,#-32
prs_crd:
moveq #3,d6
lea persmatx,a3
prs_elmnt:
move.w (a0),d0
move.w (a1),d1
move.w (a2),d2
muls.w (a3)+,d0
muls.w (a3)+,d1
muls.w (a3)+,d2
add.l d1,d0
add.l d2,d0
moveq #1,d1
muls.w (a3)+,d1
add.l d1,d0
move.l d0,-(a6)
dbf d6,prs_elmnt
move.l (a6)+,d3
bne prs_ok
addq.w #1,d3
prs_ok:
addq.l #4,a6
move.l (a6)+,d4
divs.w d3,d4
addi.w #160,d4
move.w d4,(a4)+
move.l (a6)+,d4
divs.w d3,d4
subi.w #199,d4
neg.w d4
move.w d4,(a5)+
addq.l #2,a0
addq.l #2,a1
addq.l #2,a2
dbf d7,prs_crd
unlk a6
prs_end:
rts
polydraw:
move.w npoly,d7
beq polydraw5
subq.w #1,d7
lea scoordsx,a0
lea scoordsy,a1
lea sedglst,a2
lea snedges,a3
lea col_lst,a4
polydraw2:
move.w (a4)+,d0
cmpi.w #$f,d0
ble polydraw3
move.w (a3)+,d0
addq.w #1,d0
add.w d0,d0
adda.w d0,a2
bra polydraw4
polydraw3:
move.w d0,colour
move.w (a3)+,d0
beq polydraw3
move.w d0,no_in
lea crds_in,a5
polydraw1:
move.w (a2)+,d1
lsl.w #1,d1
move.w 0(a0,d1.w),(a5)+
move.w 0(a1,d1.w),(a5)+
dbf d0,polydraw1
movem.l d7/a0-a4,-(sp)
bsr clip
bsr poly_fil
movem.l (sp)+,d7/a0-a4
polydraw4:
dbra d7,polydraw2
polydraw5:
rts
polypoints:
movem.l d0-d3/d7/a0-a5,-(sp)
move.w npts,d7
beq polyptend
subq.w #1,d7
lea scoordsx,a0
lea scoordsy,a1
lea crds_in,a5
lea col_lst,a4
clr.w d1
polypt1:
move.w (a0)+,d2
move.w (a1)+,d3
move.w (a4)+,d0
; beq.s polypt4
cmpi.w #$f,d0
bgt polypt4
; move.w d0,colour
move.w d2,(a5)+
move.w d3,(a5)+
addq.w #1,d1
polypt4:
dbra d7,polypt1
move.w d1,no_in
bsr poly_point
polyptend:
movem.l (sp)+,d0-d3/d7/a0-a5
rts
polywire:
move.w npoly,d7
beq polywire5
subq.w #1,d7
lea scoordsx,a0
lea scoordsy,a1
lea sedglst,a2
lea snedges,a3
lea col_lst,a4
polywire2:
move.w (a4)+,d0
; beq.s hide_polyline
cmpi.w #$f,d0
ble polywire3
hide_polyline:
move.w (a3)+,d0
addq.w #1,d0
add.w d0,d0
adda.w d0,a2
bra polywire4
polywire3:
move.w d0,colour
move.w (a3)+,d0
beq polywire3
move.w d0,no_in
lea crds_in,a5
polywire1:
move.w (a2)+,d1
lsl.w #1,d1
move.w 0(a0,d1.w),(a5)+
move.w 0(a1,d1.w),(a5)+
dbf d0,polywire1
movem.l d7/a0-a4,-(sp)
bsr no_clip ; actually no clipping
bsr poly_line
movem.l (sp)+,d7/a0-a4
polywire4:
dbra d7,polywire2
polywire5:
rts
.INCLUDE 'CORE_01.IS'

+ 205
- 0
core_03.s View File

@@ -0,0 +1,205 @@
.INCLUDE 'CORE_02.IS'
sincos:
lea sintable,a5
cmpi.w #360,d1
bmi less360
subi.w #360,d1
less360:
cmpi.w #270,d1
bmi less270
bsr over270
rts
less270:
cmpi.w #180,d1
bmi less180
bsr over180
rts
less180:
cmpi.w #90,d1
bmi less90
bsr over90
rts
less90:
add.w d1,d1
move.w 0(a5,d1.w),d2
subi.w #180,d1
neg.w d1
move.w 0(a5,d1.w),d3
rts
over270:
subi.w #360,d1
neg.w d1
add.w d1,d1
move.w 0(a5,d1.w),d2
neg.w d2
subi.w #180,d1
neg.w d1
move.w 0(a5,d1.w),d3
rts
over180:
subi.w #180,d1
add.w d1,d1
move.w 0(a5,d1.w),d2
neg.w d2
subi.w #180,d1
neg.w d1
move.w 0(a5,d1.w),d3
neg.w d3
rts
over90:
subi.w #180,d1
neg.w d1
add.w d1,d1
move.w 0(a5,d1.w),d2
subi.w #180,d1
neg.w d1
move.w 0(a5,d1.w),d3
neg.w d3
rts
otranw:
move.w otheta,d1
bsr sincos
move.w d2,stheta
move.w d3,ctheta
move.w ophi,d1
bsr sincos
move.w d2,sphi
move.w d3,cphi
move.w ogamma,d1
bsr sincos
move.w d2,sgamma
move.w d3,cgamma
lea stheta,a0
lea ctheta,a1
lea sphi,a2
lea cphi,a3
lea sgamma,a4
lea cgamma,a5
lea o_wmatx,a6
; OM11
move.w (a3),d0
muls.w (a5),d0
lsl.l #2,d0
swap.w d0
move.w d0,(a6)+
; OM12
move.w (a3),d0
muls.w (a4),d0
neg.l d0
lsl.l #2,d0
swap.w d0
move.w d0,(a6)+
; OM13
move.w (a2),(a6)+
; OM21
move.w (a1),d0
muls.w (a4),d0
move.w (a0),d1
muls.w (a2),d1
lsl.l #2,d1
swap.w d1
muls.w (a5),d1
add.l d1,d0
lsl.l #2,d0
swap.w d0
move.w d0,(a6)+
; OM22
move.w (a1),d0
muls.w (a5),d0
move.w (a0),d1
muls.w (a2),d1
lsl.l #2,d1
swap.w d1
muls.w (a4),d1
sub.l d1,d0
lsl.l #2,d0
swap.w d0
move.w d0,(a6)+
; OM23
move.w (a0),d0
muls.w (a3),d0
neg.l d0
lsl.l #2,d0
swap.w d0
move.w d0,(a6)+
; OM31
move.w (a0),d0
muls.w (a4),d0
move.w (a1),d1
muls.w (a2),d1
lsl.l #2,d1
swap.w d1
muls.w (a5),d1
sub.l d1,d0
lsl.l #2,d0
swap.w d0
move.w d0,(a6)+
; OM32
move.w (a0),d0
muls.w (a5),d0
move.w (a1),d1
muls.w (a2),d1
lsl.l #2,d1
swap.w d1
muls.w (a4),d1
add.l d1,d0
lsl.l #2,d0
swap.w d0
move.w d0,(a6)+
; OM33
move.w (a1),d0
muls.w (a3),d0
lsl.l #2,d0
swap.w d0
move.w d0,(a6)+
move.w oncoords,d7
ext.l d7
beq otranw3
subq.w #1,d7
lea ocoordsx,a0
lea ocoordsy,a1
lea ocoordsz,a2
lea wcoordsx,a3
lea wcoordsy,a4
lea wcoordsz,a5
exg.l a3,d3
link a6,#-6
otranw1:
moveq.l #2,d6
lea o_wmatx,a3
otranw2:
move.w (a0),d0
move.w (a1),d1
move.w (a2),d2
muls.w (a3)+,d0
muls.w (a3)+,d1
muls.w (a3)+,d2
add.l d1,d0
add.l d2,d0
lsl.l #2,d0
swap.w d0
move.w d0,-(a6)
dbf d6,otranw2
move.w (a6)+,d0
add.w Ooz,d0
move.w d0,(a5)+
move.w (a6)+,d0
add.w Ooy,d0
move.w d0,(a4)+
exg.l a3,d3
move.w (a6)+,d0
add.w Oox,d0
move.w d0,(a3)+
exg.l a3,d3
addq.l #2,a0
addq.l #2,a1
addq.l #2,a2
dbf d7,otranw1
unlk a6
otranw3:
rts

+ 21
- 0
data_00.s View File

@@ -0,0 +1,21 @@
fg_bp1 equ 24
fg_bp2 equ 26
fg_bp3 equ 28
fg_bp4 equ 30
wrt_mod equ 36
x1 equ 38
y1 equ 40
x2 equ 42
patptr equ 46
patmsk equ 50
multifil equ 52
initlinea equ $a000
hline equ $a004
fill: .DC.w %1111111111111111
.DC.w %1010101010101010
.DC.w %1001100110011001
.DC.w %1111111111111111

+ 446
- 0
data_01.s View File

@@ -0,0 +1,446 @@
;my_datax: .DC.w 115,115,25,25,100,100,40,40,92,92,81,81
; .DC.w 70,70,55,55,100,100,81,81,81,81,40,40
;my_datay: .DC.w -100,100,100,-100,-80,-20,-20,-80,-60
; .DC.w -20,-20,-60,-80,-40,-40,-80,0,80,80
; .DC.w 0,25,55,55,25
;my_dataz: .DC.w 120,120,0,0,100,100,20,20,90,90,75,75
; .DC.w 60,60,40,40,100,100,75,75,75,75,20,20
;my_edglst: .DC.w 0,1,2,3,0,4,5,6,7,4,8,9,10,11,8,12,13,14,15,12
; .DC.w 16,17,18,19,16,20,21,22,23,20
;my_nedges: .DC.w 4,4,4,4,4,4
;my_npoly: .DC.w 6
;my_colour: .DC.w 1,2,1,1,2,2
;XOFF equ (-35)
XOFF equ 0
; cells as points
my_ptsx:
xc set 0
.REPT 8
.REPT 64
.DC.w 140-xc*40
.ENDR
xc set xc+1
.ENDR
my_ptsy:
.REPT 8
yc set 0
.REPT 8
.REPT 8
.DC.w -140+40*yc
.ENDR
yc set yc+1
.ENDR
.ENDR
my_ptsz:
.REPT 8
.REPT 8
zc set 0
.REPT 8
.DC.w -128+zc*32
zc set zc+1
.ENDR
.ENDR
.ENDR
my_ptscolour:
.REPT 512
.DC.w 1
.ENDR
my_npts:
.DC.w 512
; cube
my_datax:
.DC.w 160+XOFF,160+XOFF,160+XOFF,160+XOFF
.DC.w -160+XOFF,-160+XOFF,-160+XOFF,-160+XOFF
my_datay:
.DC.w -160,-160,160,160
.DC.w -160,-160,160,160
my_dataz:
.DC.w -128-32,128+32,-128-32,128+32
.DC.w -128-32,128+32,-128-32,128+32
; tcr - required for polylines
my_nocoords: .DC.w 8
; /tcr
my_edglst:
; top
.DC.w 0,1,3,2,0
; bottom
.DC.w 4,5,7,6,4
; left
.DC.w 0,1,5,4,0
; right
.DC.w 3,2,6,7,3
my_nedges:
.DC.w 4,4,4,4
my_npoly: .DC.w 4
my_colour:
.DC.w 2,2,2,2
;; cells
;my_datax:
;; 64er layers from top to bottom
;xc set 0
; .REPT 8
; .REPT 64
; .DC.w 140-xc*40-1+XOFF,140-xc*40+1+XOFF
; .ENDR
;xc set xc+1
; .ENDR
;; cube
; .DC.w 160+XOFF,160+XOFF,160+XOFF,160+XOFF
; .DC.w -160+XOFF,-160+XOFF,-160+XOFF,-160+XOFF
;my_datay:
; .REPT 8
;yc set 0
; .REPT 8
; .REPT 8
; .DC.w -140+40*yc,-140+40*yc
; .ENDR
;yc set yc+1
; .ENDR
; .ENDR
; .DC.w -160,-160,160,160
; .DC.w -160,-160,160,160
;my_dataz:
; .REPT 8
; .REPT 8
;zc set 0
; .REPT 8
; .DC.w zc*32,zc*32
;zc set zc+1
; .ENDR
; .ENDR
; .ENDR
;; cube
; .DC.w -32,256+32,-32,256+32
; .DC.w -32,256+32,-32,256+32
;; tcr - required for polylines
;my_nocoords: .DC.w 1024+8
;; /tcr
;
;my_edglst:
;curpt set 0
; .REPT 1024
; .DC.w curpt
;curpt set curpt+1
; .ENDR
;; top
; .DC.w 1024,1025,1027,1026,1024
;; bottom
; .DC.w 1028,1029,1031,1030,1028
;; left
; .DC.w 1024,1025,1029,1028,1024
;; right
; .DC.w 1027,1026,1030,1031,1027
;
;my_nedges:
; .REPT 512
; .DC.w 1
; .ENDR
; .DC.w 4,4,4,4
;my_npoly: .DC.w 512+4
;my_colour:
; .REPT 32
; .DC.w 1,2,3,4,5,6,7,8
; .DC.w 8,7,6,5,4,3,2,1
; .ENDR
; .DC.w 2,2,2,2
; lines
;my_datax: .DC.w 140,140,140,140,140,140,140,140
; .DC.w 140,140,140,140,140,140,140,140
; .DC.w 100,100,100,100,100,100,100,100
; .DC.w 100,100,100,100,100,100,100,100
; .DC.w 60,60,60,60,60,60,60,60
; .DC.w 60,60,60,60,60,60,60,60
; .DC.w 20,20,20,20,20,20,20,20
; .DC.w 20,20,20,20,20,20,20,20
; .DC.w -20,-20,-20,-20,-20,-20,-20,-20
; .DC.w -20,-20,-20,-20,-20,-20,-20,-20
; .DC.w -60,-60,-60,-60,-60,-60,-60,-60
; .DC.w -60,-60,-60,-60,-60,-60,-60,-60
; .DC.w -100,-100,-100,-100,-100,-100,-100,-100
; .DC.w -100,-100,-100,-100,-100,-100,-100,-100
; .DC.w -140,-140,-140,-140,-140,-140,-140,-140
; .DC.w -140,-140,-140,-140,-140,-140,-140,-140
;xc set 0
; .REPT 8
; .REPT 64
; .DC.w 140-xc*40-2,140-xc*40+2
; .ENDR
;xc set xc+1
; .ENDR
;
;my_datay: .DC.w -140,-140,-100,-100,-60,-60,-20,-20
; .DC.w 20,20,60,60,100,100,140,140
; .DC.w -140,-140,-100,-100,-60,-60,-20,-20
; .DC.w 20,20,60,60,100,100,140,140
; .DC.w -140,-140,-100,-100,-60,-60,-20,-20
; .DC.w 20,20,60,60,100,100,140,140
; .DC.w -140,-140,-100,-100,-60,-60,-20,-20
; .DC.w 20,20,60,60,100,100,140,140
; .DC.w -140,-140,-100,-100,-60,-60,-20,-20
; .DC.w 20,20,60,60,100,100,140,140
; .DC.w -140,-140,-100,-100,-60,-60,-20,-20
; .DC.w 20,20,60,60,100,100,140,140
; .DC.w -140,-140,-100,-100,-60,-60,-20,-20
; .DC.w 20,20,60,60,100,100,140,140
; .DC.w -140,-140,-100,-100,-60,-60,-20,-20
; .DC.w 20,20,60,60,100,100,140,140
; .REPT 64
;yc set 0
; .REPT 8
; .DC.w -140+yc*40,-140+yc*40
;yc set yc+1
; .ENDR
; .ENDR
;
;my_dataz: .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .DC.w 0,128,0,128,0,128,0,128
; .REPT 8
;zc set 0
; .REPT 8
; .REPT 8
; .DC.w zc*16,zc*16
; .ENDR
;zc set zc+1
; .ENDR
; .ENDR
;
;; tcr - required for polylines
;my_nocoords: .DC.w 128+512
;; /tcr
;;my_edglst: .DC.w 0,1,0,2,3,2,4,5,4,6,7,6
;; .DC.w 8,9,8,10,11,10,12,13,12,14,15,14
;; .DC.w 16,17,16,18,19,18,20,21,20,22,23,22
;; .DC.w 24,25,24,26,27,26,28,29,28,30,31,30
;; .DC.w 32,33,32,34,35,34,36,37,36,38,39,38
;; .DC.w 40,41,40,42,43,42,44,45,44,46,47,46
;; .DC.w 48,49,48,50,51,50,52,53,52,54,55,54
;; .DC.w 56,57,56,58,59,58,60,61,60,62,63,62
;; .DC.w 64,65,64,66,67,66,68,69,68,70,71,70
;; .DC.w 72,73,72,74,75,74,76,77,76,78,79,78
;; .DC.w 80,81,80,82,83,82,84,85,84,86,87,86
;; .DC.w 88,89,88,90,91,90,92,93,92,94,95,94
;; .DC.w 96,97,96,98,99,98,100,101,100,102,103,102
;; .DC.w 104,105,104,106,107,106,108,109,108,110,111,110
;; .DC.w 112,113,112,114,115,114,116,117,116,118,119,118
;; .DC.w 120,121,120,122,123,122,124,125,124,126,127,126
;my_edglst: .DC.w 0,1,2,3,4,5,6,7
; .DC.w 8,9,10,11,12,13,14,15
; .DC.w 16,17,18,19,20,21,22,23
; .DC.w 24,25,26,27,28,29,30,31
; .DC.w 32,33,34,35,36,37,38,39
; .DC.w 40,41,42,43,44,45,46,47
; .DC.w 48,49,50,51,52,53,54,55
; .DC.w 56,57,58,59,60,61,62,63
; .DC.w 64,65,66,67,68,69,70,71
; .DC.w 72,73,74,75,76,77,78,79
; .DC.w 80,81,82,83,84,85,86,87
; .DC.w 88,89,90,91,92,93,94,95
; .DC.w 96,97,98,99,100,101,102,103
; .DC.w 104,105,106,107,108,109,110,111
; .DC.w 112,113,114,115,116,117,118,119
; .DC.w 120,121,122,123,124,125,126,127
;
;curpt set 128
; .REPT 1024
; .DC.w curpt
;curpt set curpt+1
; .ENDR
;
;my_nedges: .DC.w 1,1,1,1,1,1,1,1
; .DC.w 1,1,1,1,1,1,1,1
; .DC.w 1,1,1,1,1,1,1,1
; .DC.w 1,1,1,1,1,1,1,1
; .DC.w 1,1,1,1,1,1,1,1
; .DC.w 1,1,1,1,1,1,1,1
; .DC.w 1,1,1,1,1,1,1,1
; .DC.w 1,1,1,1,1,1,1,1
; .REPT 512
; .DC.w 1
; .ENDR
;my_npoly: .DC.w 64+512
;my_colour: .DC.w 1,2,3,4,5,6,7,8
; .DC.w 8,7,6,5,4,3,2,1
; .DC.w 1,2,3,4,5,6,7,8
; .DC.w 8,7,6,5,4,3,2,1
; .DC.w 1,2,3,4,5,6,7,8
; .DC.w 8,7,6,5,4,3,2,1
; .DC.w 1,2,3,4,5,6,7,8
; .DC.w 8,7,6,5,4,3,2,1
; .REPT 32
; .DC.w 1,2,3,4,5,6,7,8
; .DC.w 8,7,6,5,4,3,2,1
; .ENDR
; squares
;my_datax: .DC.w 160-5,160-5,120+5,120+5,160-5,160-5,120+5,120+5
; .DC.w 160-5,160-5,120+5,120+5,160-5,160-5,120+5,120+5
; .DC.w 160-5,160-5,120+5,120+5,160-5,160-5,120+5,120+5
; .DC.w 160-5,160-5,120+5,120+5,160-5,160-5,120+5,120+5
; .DC.w 120-5,120-5,80+5,80+5,120-5,120-5,80+5,80+5
; .DC.w 120-5,120-5,80+5,80+5,120-5,120-5,80+5,80+5
; .DC.w 120-5,120-5,80+5,80+5,120-5,120-5,80+5,80+5
; .DC.w 120-5,120-5,80+5,80+5,120-5,120-5,80+5,80+5
; .DC.w 80-5,80-5,40+5,40+5,80-5,80-5,40+5,40+5
; .DC.w 80-5,80-5,40+5,40+5,80-5,80-5,40+5,40+5
; .DC.w 80-5,80-5,40+5,40+5,80-5,80-5,40+5,40+5
; .DC.w 80-5,80-5,40+5,40+5,80-5,80-5,40+5,40+5
; .DC.w 40-5,40-5,0+5,0+5,40-5,40-5,0+5,0+5
; .DC.w 40-5,40-5,0+5,0+5,40-5,40-5,0+5,0+5
; .DC.w 40-5,40-5,0+5,0+5,40-5,40-5,0+5,0+5
; .DC.w 40-5,40-5,0+5,0+5,40-5,40-5,0+5,0+5
; .DC.w 0-5,0-5,-40+5,-40+5,0-5,0-5,-40+5,-40+5
; .DC.w 0-5,0-5,-40+5,-40+5,0-5,0-5,-40+5,-40+5
; .DC.w 0-5,0-5,-40+5,-40+5,0-5,0-5,-40+5,-40+5
; .DC.w 0-5,0-5,-40+5,-40+5,0-5,0-5,-40+5,-40+5
; .DC.w -40-5,-40-5,-80+5,-80+5,-40-5,-40-5,-80+5,-80+5
; .DC.w -40-5,-40-5,-80+5,-80+5,-40-5,-40-5,-80+5,-80+5
; .DC.w -40-5,-40-5,-80+5,-80+5,-40-5,-40-5,-80+5,-80+5
; .DC.w -40-5,-40-5,-80+5,-80+5,-40-5,-40-5,-80+5,-80+5
; .DC.w -80-5,-80-5,-120+5,-120+5,-80-5,-80-5,-120+5,-120+5
; .DC.w -80-5,-80-5,-120+5,-120+5,-80-5,-80-5,-120+5,-120+5
; .DC.w -80-5,-80-5,-120+5,-120+5,-80-5,-80-5,-120+5,-120+5
; .DC.w -80-5,-80-5,-120+5,-120+5,-80-5,-80-5,-120+5,-120+5
; .DC.w -120-5,-120-5,-160+5,-160+5,-120-5,-120-5,-160+5,-160+5
; .DC.w -120-5,-120-5,-160+5,-160+5,-120-5,-120-5,-160+5,-160+5
; .DC.w -120-5,-120-5,-160+5,-160+5,-120-5,-120-5,-160+5,-160+5
; .DC.w -120-5,-120-5,-160+5,-160+5,-120-5,-120-5,-160+5,-160+5
;my_datay: .DC.w -160+5,-120-5,-120-5,-160+5,-120+5,-80-5,-80-5,-120+5
; .DC.w -80+5,-40-5,-40-5,-80+5,-40+5,0-5,0-5,-40+5
; .DC.w 0+5,40-5,40-5,0+5,40+5,80-5,80-5,40+5
; .DC.w 80+5,120-5,120-5,80+5,120+5,160-5,160-5,120+5
; .DC.w -160+5,-120-5,-120-5,-160+5,-120+5,-80-5,-80-5,-120+5
; .DC.w -80+5,-40-5,-40-5,-80+5,-40+5,0-5,0-5,-40+5
; .DC.w 0+5,40-5,40-5,0+5,40+5,80-5,80-5,40+5
; .DC.w 80+5,120-5,120-5,80+5,120+5,160-5,160-5,120+5
; .DC.w -160+5,-120-5,-120-5,-160+5,-120+5,-80-5,-80-5,-120+5
; .DC.w -80+5,-40-5,-40-5,-80+5,-40+5,0-5,0-5,-40+5
; .DC.w 0+5,40-5,40-5,0+5,40+5,80-5,80-5,40+5
; .DC.w 80+5,120-5,120-5,80+5,120+5,160-5,160-5,120+5
; .DC.w -160+5,-120-5,-120-5,-160+5,-120+5,-80-5,-80-5,-120+5
; .DC.w -80+5,-40-5,-40-5,-80+5,-40+5,0-5,0-5,-40+5
; .DC.w 0+5,40-5,40-5,0+5,40+5,80-5,80-5,40+5
; .DC.w 80+5,120-5,120-5,80+5,120+5,160-5,160-5,120+5
; .DC.w -160+5,-120-5,-120-5,-160+5,-120+5,-80-5,-80-5,-120+5
; .DC.w -80+5,-40-5,-40-5,-80+5,-40+5,0-5,0-5,-40+5
; .DC.w 0+5,40-5,40-5,0+5,40+5,80-5,80-5,40+5
; .DC.w 80+5,120-5,120-5,80+5,120+5,160-5,160-5,120+5
; .DC.w -160+5,-120-5,-120-5,-160+5,-120+5,-80-5,-80-5,-120+5
; .DC.w -80+5,-40-5,-40-5,-80+5,-40+5,0-5,0-5,-40+5
; .DC.w 0+5,40-5,40-5,0+5,40+5,80-5,80-5,40+5
; .DC.w 80+5,120-5,120-5,80+5,120+5,160-5,160-5,120+5
; .DC.w -160+5,-120-5,-120-5,-160+5,-120+5,-80-5,-80-5,-120+5
; .DC.w -80+5,-40-5,-40-5,-80+5,-40+5,0-5,0-5,-40+5
; .DC.w 0+5,40-5,40-5,0+5,40+5,80-5,80-5,40+5
; .DC.w 80+5,120-5,120-5,80+5,120+5,160-5,160-5,120+5
; .DC.w -160+5,-120-5,-120-5,-160+5,-120+5,-80-5,-80-5,-120+5
; .DC.w -80+5,-40-5,-40-5,-80+5,-40+5,0-5,0-5,-40+5
; .DC.w 0+5,40-5,40-5,0+5,40+5,80-5,80-5,40+5
; .DC.w 80+5,120-5,120-5,80+5,120+5,160-5,160-5,120+5
;my_dataz: .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
; .DC.w 0,0,0,0,0,0,0,0
;
;my_edglst: .DC.w 0,1,2,3,0,4,5,6,7,4
; .DC.w 8,9,10,11,8,12,13,14,15,12
; .DC.w 16,17,18,19,16,20,21,22,23,20
; .DC.w 24,25,26,27,24,28,29,30,31,28
; .DC.w 32,33,34,35,32,36,37,38,39,36
; .DC.w 40,41,42,43,40,44,45,46,47,44
; .DC.w 48,49,50,51,48,52,53,54,55,52
; .DC.w 56,57,58,59,56,60,61,62,63,60
; .DC.w 64,65,66,67,64,68,69,70,71,68
; .DC.w 72,73,74,75,72,76,77,78,79,76
; .DC.w 80,81,82,83,80,84,85,86,87,84
; .DC.w 88,89,90,91,88,92,93,94,95,92
; .DC.w 96,97,98,99,96,100,101,102,103,100
; .DC.w 104,105,106,107,104,108,109,110,111,108
; .DC.w 112,113,114,115,112,116,117,118,119,116
; .DC.w 120,121,122,123,120
; .DC.w 124,125,126,127,124,128,129,130,131,128
; .DC.w 132,133,134,135,132,136,137,138,139,136
; .DC.w 140,141,142,143,140,144,145,146,147,144
; .DC.w 148,149,150,151,148,152,153,154,155,152
; .DC.w 156,157,158,159,156,160,161,162,163,160
; .DC.w 164,165,166,167,164,168,169,170,171,168
; .DC.w 172,173,174,175,172,176,177,178,179,176
; .DC.w 180,181,182,183,180,184,185,186,187,184
; .DC.w 188,189,190,191,188,192,193,194,195,192
; .DC.w 196,197,198,199,196,200,201,202,203,200
; .DC.w 204,205,206,207,204,208,209,210,211,208
; .DC.w 212,213,214,215,212,216,217,218,219,216
; .DC.w 220,221,222,223,220
; .DC.w 224,225,226,227,224,228,229,230,231,228
; .DC.w 232,233,234,235,232,236,237,238,239,236
; .DC.w 240,241,242,243,240,244,245,246,247,244
; .DC.w 248,249,250,251,248,252,253,254,255,252
;my_nedges: .DC.w 4,4,4,4,4,4,4,4
; .DC.w 4,4,4,4,4,4,4,4
; .DC.w 4,4,4,4,4,4,4,4
; .DC.w 4,4,4,4,4,4,4,4
; .DC.w 4,4,4,4,4,4,4,4
; .DC.w 4,4,4,4,4,4,4,4
; .DC.w 4,4,4,4,4,4,4,4
; .DC.w 4,4,4,4,4,4,4,4
;my_npoly: .DC.w 64
;my_colour: .DC.w 1,2,3,4,5,6,7,8
; .DC.w 8,7,6,5,4,3,2,1
; .DC.w 1,2,3,4,5,6,7,8
; .DC.w 8,7,6,5,4,3,2,1
; .DC.w 1,2,3,4,5,6,7,8
; .DC.w 8,7,6,5,4,3,2,1
; .DC.w 1,2,3,4,5,6,7,8
; .DC.w 8,7,6,5,4,3,2,1
my_xmin: .DC.w 0
my_xmax: .DC.w 319
my_ymin: .DC.w 0
my_ymax: .DC.w 199

+ 3
- 0
data_02.s View File

@@ -0,0 +1,3 @@
persmatx:
.DC.w 100,0,0,0,0,100,0,0,0,0,0,0,0,0,1,100

+ 14
- 0
data_03.s View File

@@ -0,0 +1,14 @@
sintable:
.DC.w 0,286,572,857,1143,1428,1713,1997,2280,2563,2845,3126
.DC.w 3406,3686,3964,4240,4516,4790,5063,5334,5604,5872,6138
.DC.w 6402,6664,6924,7182,7438,7692,7943,8192,8438,8682,8923
.DC.w 9162,9397,9630,9860,10087,10311,10531,10749,10963,11174
.DC.w 11381,11585,11786,11982,12176,12365,12551,12733,12911
.DC.w 13085,13255,13421,13583,13741,13894,14044,14189,14330
.DC.w 14466,14598,14726,14849,14968,15082,15191,15296,15396
.DC.w 15491,15582,15668,15749,15826,15897,15964,16026,16083
.DC.w 16135,16182,16225,16262,16294,16322,16344,16362,16374
.DC.w 16382,16384
.INCLUDE 'DATA_02.IS'

+ 1229
- 0
gol3d.s View File

@@ -0,0 +1,1229 @@
; Game of life
; 3D
; implements a 3d-game of life
; with 3d graphics output
; and output on the serial interface
; game of life parameters
; 2**sizexp border length in x,y,z
sizexp equ 3
; no need to change below here
size equ (1<<sizexp)
sizesq equ size*size
sizecube equ sizesq*size
sizex equ (size+2)
sizexsq equ sizex*sizex
sizexcube equ sizexsq*sizex
.TEXT
; free unused memory
movea.l 4(sp),a0
lea stack,sp
move.l #$100,d0
add.l $c(a0),d0
add.l $14(a0),d0
add.l $1c(a0),d0
move.l d0,-(sp)
move.l a0,-(sp)
clr.w -(sp)
move.w #$4a,-(sp)
trap #1
lea $c(sp),sp
; save resolution and physical screen address
bsr getrez
move.w d0,saverez
cmpi.w #2,d0
blt.s colorscreen
bra exitbw
colorscreen:
bsr getscreen
move.l d0,screen1
; crucial:
; we assume that the physical screen address is - as is default - top of ram minus 32000 bytes, i.e. at $78000
; in the following, there might be calculations done in .w, which rely on the
; fact that there is no overflow to the next word
; if the initial screen address is "wrong", everything might blow up
; switch to low resolution with physical screen -$8000 as logical screen address
; again, we count on no word overflow
move.w #0,d0
movea.l screen1,a0
movea.l a0,a1
suba.l #$8000,a1
move.l a1,screen2
bsr setrez
bsr waitvbi
bsr hide_mse
pea save_palette_sup
move.w #$26,-(sp)
trap #14
addq.l #6,sp
; movem.l $ffff8240,d0-d7
; lea stdpalette,a0
; movem.l d0-d7,(a0)
bsr palette_set
; prepare point coordinates
move.w my_npts,d7
; beq exit
move.w d7,oncoords
move.w d7,npts
beq prepare_coords
subq.w #1,d7
move.w d7,d0
lea my_ptscolour,a2
lea col_lst,a3
ptloop0:
move.w (a2)+,(a3)+
dbra d0,ptloop0
lea ocoordsx,a1
lea my_ptsx,a0
lea ocoordsy,a3
lea my_ptsy,a2
lea ocoordsz,a5
lea my_ptsz,a4
ptloop1:
move.w (a0)+,(a1)+
move.w (a2)+,(a3)+
move.w (a4)+,(a5)+
dbra d7,ptloop1
; prepare coordinates
prepare_coords:
move.w my_npoly,d7
beq exit
move.w d7,npoly
subq.w #1,d7
lea my_nedges,a0
lea snedges,a1
lea my_colour,a2
lea col_lst,a3
; append to the points color list
move.w npts,d0
add.w d0,d0
lea 0(a3,d0.w),a3
move.w d7,d0
loop0:
move.w (a0)+,(a1)+
move.w (a2)+,(a3)+
dbra d0,loop0
move.w d7,d0
lea my_nedges,a6
clr.w d1
clr.w d2
loop1:
add.w (a6),d1
add.w (a6)+,d2
addq.w #1,d2
dbra d0,loop1
subq.w #1,d2
lea my_edglst,a0
lea sedglst,a1
move.w npts,d0
loop2:
; move.w (a0)+,(a1)+
; offset by number of points...
move.w (a0)+,(a1)
add.w d0,(a1)+
dbra d2,loop2
; methinks this is only correct for polygons, not for (non-closed) polylines or single points...
; move.w d1,oncoords
; subq.w #1,d1
; so, we use the number provided in my_nocoords
move.w my_nocoords,d1
; move.w d1,oncoords
; append to the points...
add.w d1,oncoords
subq.w #1,d1
lea ocoordsx,a1
lea my_datax,a0
lea ocoordsy,a3
lea my_datay,a2
lea ocoordsz,a5
lea my_dataz,a4
; append to points
move.w npts,d0
add.w d0,d0
lea 0(a1,d0.w),a1
lea 0(a3,d0.w),a3
lea 0(a5,d0.w),a5
loop3:
move.w (a0)+,(a1)+
move.w (a2)+,(a3)+
move.w (a4)+,(a5)+
dbra d1,loop3
move.w my_xmin,xmin
move.w my_xmax,xmax
move.w my_ymin,ymin
move.w my_ymax,ymax
; move.w #200,Oox
; move.w #200,Ooz
; clr.w Ooy
; cube center
move.w #250,Oox
clr.w Ooy
move.w #300,Ooz
clr.w otheta
; move.w #50,ophi
clr.w ophi
clr.w ogamma
movea.l screen1,a0
bsr clearscreen
movea.l screen2,a0
bsr clearscreen
jsr main
exit:
move.w saverez,d0
movea.l screen1,a0
movea.l screen1,a1
bsr setrez
; bsr palette_reset
; restore palette
; movem.l stdpalette,d0-d7
; movem.l d0-d7,$ffff8240
pea restore_palette_sup
move.w #$26,-(sp)
trap #14
addq.l #6,sp
bsr waitvbi
exitbw:
clr.w -(sp)
trap #1
; move.w #0,-(sp)
; move.w #$4c,-(sp)
; trap #1
save_palette_sup:
movem.l $ffff8240,d0-d7
lea stdpalette,a0
movem.l d0-d7,(a0)
rts
restore_palette_sup:
movem.l stdpalette,d0-d7
movem.l d0-d7,$ffff8240
rts
scan_keys:
move.w #2,-(sp)
move.w #1,-(sp)
trap #13
addq.l #4,sp
rts
read_key:
move.w #2,-(sp)
move.w #2,-(sp)
trap #13
addq.l #4,sp
rts
hide_mse:
.DC.w $a000
.DC.w $a00a
rts
getrez:
move.w #4,-(sp)
trap #14
addq.l #2,sp
rts
setrez:
move.w d0,-(sp)
move.l a0,-(sp)
move.l a1,-(sp)
move.w #5,-(sp)
trap #14
lea $c(sp),sp
rts
getscreen:
move.w #2,-(sp)
trap #14
addq.l #2,sp
rts
waitvbi:
move.w #37,-(sp)
trap #14
addq.l #2,sp
rts
; clear the screen - address in a0
; destroys d0-d7, a1-a6
clearscreen:
adda.l #32000,a0
; move.w #614,d7
moveq.l #0,d0
move.l d0,d1
move.l d1,d2
move.l d2,d3
move.l d3,d4
move.l d4,d5
move.l d5,d6
move.l d6,d7
movea.l d7,a1
movea.l a1,a2
movea.l a2,a3
movea.l a3,a4
movea.l a4,a5
movea.l a5,a6
;clrloop:
; 571 * 56 bytes = 31976
.REPT 571
movem.l d0-d7/a1-a6,-(a0)
.ENDR
; the missing 24 bytes
movem.l d0-d5,-(a0)
; dbf d7,clrloop
rts
clearboard:
lea board,a0
move.w #sizecube,d1
lsr.w #2,d1
subq.w #1,d1
cbloop:
clr.l (a0)+
dbra d1,cbloop
rts
initboard:
bsr clearboard
lea board,a0
move.w #(size*sizesq/2)+(sizesq/2)+(size/2),d0 ; pattern "I"
move.b #1,0(a0,d0.w)
addi.w #sizesq,d0
move.b #1,-1(a0,d0.w)
move.b #1,1(a0,d0.w)
move.b #1,size(a0,d0.w)
move.b #1,-size(a0,d0.w)
addi.w #sizesq,d0
move.b #1,1(a0,d0.w)
move.b #1,-1(a0,d0.w)
rts
initboardglider:
bsr clearboard
lea board,a0
move.w #((size/2)*sizesq-1)+2*size,d0
move.b #1,2(a0,d0.w)
move.b #1,3(a0,d0.w)
move.b #1,2+size(a0,d0.w)
move.b #1,size+3(a0,d0.w)
addi.w #sizesq,d0
move.b #1,1(a0,d0.w)
move.b #1,4(a0,d0.w)
move.b #1,1+size(a0,d0.w)
move.b #1,4+size(a0,d0.w)
addi.w #sizesq+size,d0
move.b #1,2(a0,d0.w)
move.b #1,3(a0,d0.w)
rts
initboardrnd:
lea board,a6
move.l #sizecube-1,d3
initbloop:
clr.l d0
clr.b d6
move.w #$11,-(sp)
trap #14
addq.l #2,sp
; andi.l #$00ffffff,d0
; 24 bit random number in d0
; check if bit 16 (arbitrary) is set
btst.l #16,d0
beq initbcont
move.b #1,d6
initbcont:
move.b d6,(a6)+
dbra d3,initbloop
rts
clearneighbours:
lea neighbours,a0
move.w #sizexcube,d1
lsr.w #2,d1 ; not bytes but longwords
subq.w #1,d1
cnloop:
clr.l (a0)+
dbra d1,cnloop
rts
countneighbours:
clr.w d4
clr.w d5
; clr.w d6
move.l #sizecube-1,d1
lea board,a0
lea neighbours,a1
; move the pointer to start of board
lea sizexsq+sizex+1(a1),a1
countnloop:
move.b (a0)+,d0
beq countn0
add.b d0,-1(a1)
add.b d0,1(a1)
add.b d0,-1-sizex(a1)
add.b d0,-sizex(a1)
add.b d0,1-sizex(a1)
add.b d0,-1+sizex(a1)
add.b d0,sizex(a1)
add.b d0,1+sizex(a1)
add.b d0,-sizexsq-sizex-1(a1)
add.b d0,-sizexsq-sizex(a1)
add.b d0,-sizexsq-sizex+1(a1)
add.b d0,-sizexsq-1(a1)
add.b d0,-sizexsq(a1)
add.b d0,-sizexsq+1(a1)
add.b d0,-sizexsq+sizex-1(a1)
add.b d0,-sizexsq+sizex(a1)
add.b d0,-sizexsq+sizex+1(a1)
add.b d0,sizexsq-sizex-1(a1)
add.b d0,sizexsq-sizex(a1)
add.b d0,sizexsq-sizex+1(a1)
add.b d0,sizexsq-1(a1)
add.b d0,sizexsq(a1)
add.b d0,sizexsq+1(a1)
add.b d0,sizexsq+sizex-1(a1)
add.b d0,sizexsq+sizex(a1)
add.b d0,sizexsq+sizex+1(a1)
countn0:
addq.l #1,a1
addq.w #1,d4
cmpi.w #size,d4
blt countncont
clr.w d4
addq.l #2,a1 ; skip border pixels
addq.w #1,d5
cmpi.w #size,d5
blt countncont
clr.w d5
lea 2*sizex(a1),a1
; adda.l #2*sizex,a1 ; skip border lines
; addq.w #1,d6
countncont:
dbra d1,countnloop
rts
modulus:
clr.l d0
clr.l d1
clr.l d2
; wrap the neighbours around
; very first plane -> last regular plane
lea neighbours,a0
movea.l a0,a1
adda.l #sizexcube-sizexsq-sizexsq,a1
; the following may be too large
; lea sizexcube-sizexsq-sizexsq(a1),a1
move.w #sizexsq-1,d0
modulus0:
move.b (a0)+,d1
add.b d1,(a1)+
dbra d0,modulus0
; very last plane -> first regular plane
; a1 is at very last plane, a0 at first regular
move.w #sizexsq-1,d0
modulus1:
move.b (a1)+,d1
add.b d1,(a0)+
dbra d0,modulus1
; now we handle the regular planes, top row wraps around to last regular row
lea neighbours+sizexsq,a0
lea sizexsq-sizex-sizex(a0),a1
move.w #size-1,d2
modulus2:
move.w #sizex-1,d0
modulus3:
move.b (a0)+,d1
add.b d1,(a1)+
dbra d0,modulus3
lea sizexsq-sizex(a0),a0
lea sizexsq-sizex(a1),a1
dbra d2,modulus2
; bottom row wraps around to first regular row
lea neighbours+sizexsq+sizex,a1
lea sizexsq-sizex-sizex(a1),a0
move.w #size-1,d2
modulus4:
move.w #sizex-1,d0
modulus5:
move.b (a0)+,d1
add.b d1,(a1)+
dbra d0,modulus5
lea sizexsq-sizex(a0),a0
lea sizexsq-sizex(a1),a1
dbra d2,modulus4
; very first column wraps around to last regular column
; (only consider regular rows now)
lea neighbours+sizexsq+sizex,a0
lea neighbours+sizexsq+sizex+sizex-2,a1
move.w #size-1,d2
modulus6:
move.w #size-1,d0
modulus7:
move.b (a0),d1
add.b d1,(a1)
adda.l #sizex,a0
adda.l #sizex,a1
dbra d0,modulus7
lea 2*sizex(a0),a0
lea 2*sizex(a1),a1
dbra d2,modulus6
; very last column wraps around to first regular column
; (only consider regular rows now)
lea neighbours+sizexsq+sizex+1,a1
lea neighbours+sizexsq+sizex+sizex-1,a1
move.w #size-1,d2
modulus8:
move.w #size-1,d0
modulus9:
move.b (a0),d1
add.b d1,(a1)
adda.l #sizex,a0
adda.l #sizex,a1
dbra d0,modulus9
lea 2*sizex(a0),a0
lea 2*sizex(a1),a1
dbra d2,modulus8
; still TODO: handle the 8 corners correctly!
rts
setboard:
movem.l d7,-(sp)
clr.w d0
clr.w d1
; move.w #0,d0 ; x coordinate
; move.w #0,d1 ; y coordinate
; move.b Fl,d5
; move.b Fu,d6
; movea.b El,a2
; movea.b Eu,a3
lea board,a5
lea neighbours,a6
lea sizexsq+sizex+1(a6),a6 ; move to beginning of board data
move.l #sizecube-1,d7
setbloop:
move.b (a6)+,d4
move.b (a5),d3
tst.b d3
bne wasfull
wasempty:
; check vs fertility rate
cmp.b Fl,d4 ; Fl
blt.s contsb
cmp.b Fu,d4 ; Fu
bgt.s contsb
; a new cell is born
move.b #1,d3
bra.s contsb
wasfull:
; check vs extinction rate
move.b #0,d3
cmp.b El,d4 ; El
blt.s contsb
cmp.b Eu,d4 ; Eu
bgt.s contsb
; the cell lives on
move.b #1,d3
contsb:
move.b d3,(a5)+
addq.w #1,d0
cmpi.w #size,d0
blt.s contsb0
clr.w d0
addq.l #2,a6 ; skip border
addq.w #1,d1
cmpi.w #size,d1
blt.s contsb0
clr.w d1
lea 2*sizex(a6),a6
contsb0:
dbra d7,setbloop
movem.l (sp)+,d7
rts
allzero:
clr.b d1
move.w #sizecube,d0
lsr.w #2,d0 ; not bytes, but longwords
subq.w #1,d0
lea board,a0
allzloop:
tst.l (a0)+
bne nonzero
dbra d0,allzloop
rts
nonzero:
move.b #1,d1
rts
initser:
; init serial interface
; synchron character - unused
move.w #-1,-(sp) ; scr
move.w #-1,-(sp) ; tsr
move.w #-1,-(sp) ; rsr