This page (revision-5) was last changed on 03-Feb-2023 15:21 by Gromit 

This page was created on 18-Dec-2010 10:38 by Carsten Strotmann

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
5 03-Feb-2023 15:21 9 KB Gromit to previous
4 01-Feb-2011 14:59 8 KB Gromit to previous | to last
3 01-Feb-2011 14:53 4 KB Gromit to previous | to last
2 18-Dec-2010 10:40 146 bytes Carsten Strotmann to previous | to last
1 18-Dec-2010 10:38 108 bytes Carsten Strotmann to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 7 added one line
!!!Stars 3-D
At line 23 changed one line
# Negative FOR loops do not work. Try:
1. Negative FOR loops do not work. Try:
At line 25 changed one line
# You cannot initialize a variable to a negative number.
2. You cannot initialize a variable to a negative number.
At line 28 changed one line
# The example on page 123 of the manual doesn't work (at least with Version 3.5 of Action!). PRINTCE(rec. idnum) prints the wrong answer. For some reason, PRINTCE(rec. idnum*1) gives the right answer.
3. The example on page 123 of the manual doesn't work (at least with Version 3.5 of Action!). PRINTCE(rec. idnum) prints the wrong answer. For some reason, PRINTCE(rec. idnum*1) gives the right answer.
At line 31 added 162 lines
----
Action! Listing
{{{
; *********************
; * STARS 3D DEMO *
; * BY CRAIG PATCHETT *
; * ACTION! VERSION *
; * BY DON GLOVER *
; *********************
; system equates
CARD sdmctl=$022F,
nmien=$D40E,
random=$D20A,
wsync=$D40A,
sdlstl=$0230,
vdslst=$0200,
colpf0=$d016,
color4=$02C8,
xitvbl=$E462
BYTE index ;used to index into strcol
CARD indrct=$D6 ;pointer for indirect addressing
BYTE ARRAY timer=[8 8 6 6 5 5 3 3 2 2 1 1], ; timers for scrolling
timary=[8 8 6 6 5 5 3 3 2 2 1 1], ;values to reset timers
mancol=[$22 $24 $26 $28 $2A $2C $2E $22], ; star colors
; ***careful-requires a 40k machine to work
dlist(600)=35840, ;display list
strlin(768)=36864, ;star(screen) memory
; *****************************************
strtpl(16), ;addresses of beginning of
strtph(16), ;each star line
strpos(16), ;position of star on line
strcol(192) ;color of each line
CARD ARRAY strtp(16) ;temp. hold addresses to be
;transferred into strtpl,strtph
PROC setvbv=$E45C(BYTE command,vblankhigh,vblanklow)
; ***********************************
PROC SCROLL(BYTE dummy,starindex) ; star scroll routine
; ACTION! is too much trouble to use here with all the bit twiddling
[
$BD $FFFF ; LDA STRTPL,X
$85 INDRCT ; STA INDRCT
$BD $FFFF ; LDA STRTPH,X
$85 INDRCT+1 ; STA INDRCT+1
$BC $FFFF ; LDY STRPOS,X
$B1 INDRCT ; LDA (INDRCT),Y
$0A ; ASL
$0A ; ASL
$91 INDRCT ; STA (INDRCT),Y
$90 $0F ; BCC SCRBR1
$A9 $01 ; LDA #1
$88 ; DEY
$C0 $FF ; CPY =255
$D0 $02 ; BNE SCRBR2
$A0 $2F ; LDY #47
; SCRBR2
$91 INDRCT ; STA (INDRCT),Y
$98 ; TYA
$9D $FFFF ; STA STRPOS,X
; SCRBR1
]
RETURN
; ************************************
PROC cntdwn() ; timer routine
BYTE starcounter
scroll(0,13) scroll(0,13) ; move fastest star
scroll(0,12) scroll(0,12) ; and its twin
; now do rest of stars
FOR starcounter=0 to 11
DO
timer(starcounter)==-1
IF timer(starcounter)=0 THEN
scroll(0,starcounter) ; scroll if ready
timer(starcounter)=timary(starcounter) ; reset timer
FI
OD
RETURN
; **********************************
PROC vblank() ; vblank routine
cntdwn()
index=0 ; back to scan line zero
[
$4C xitvbl ; jmp xitvbv
]
RETURN ; never gets here
; **********************************
PROC strini() ; initialize stars
BYTE counter
; set up screen memory address tables
; first use dummy array for simplicity
FOR counter=0 to 15 DO
strtp(counter)=strlin+48*counter
strpos(counter)=0 ;all stars start at pos. zero
OD
; now transfer addresses to byte arrays
FOR counter=0 to 16 DO
strtpl(counter)=strtp(counter)&255
; cannot divide numbers>32767 and get correct results
strtph(counter)=strtp(counter) RSH 8
OD
; clear star memory
ZERO(strlin,768)
; give each line a star
FOR counter=0 to 15 DO
strlin(48*counter)=64
OD
RETURN
; ***********************************
PROC dlsini() ; initialize display list
BYTE startype,offset,counter
CARD TEMP
; do for each scan line
dlist(0)=$70 dlist(1)=$70 dlist(2)=$F0
FOR counter=0 to 191
DO
dlist(3*(counter+1))=$CE ; graphics 7+
; now pick star type
startype=RAND(8)
; set color for each line
strcol(counter)=mancol(startype)
; randomize offset into memory
offset=RAND(48) ;offset into line
; now put address of line into display list
dlist(3*(counter+1)+1)=(strtp(2*startype)+offset)&255
; cannot divide numbers>32767 and get correct results
dlist(3*(counter+1)+2)=(strtp(2*startype)+offset) RSH 8
OD
; now finish up display list
dlist(579)=$41 ; jump instruction
dlist(580)=dlist&255
dlist(581)=dlist RSH 8
sdlstl=dlist ;tell antic where display list is
sdmctl=$23 ;wide screen
RETURN
; ***********************************
PROC dli() ; display list interrupt routine
; too little time to even think about using ACTION!
[
$AE INDEX ; LDX INDEX
$BD $FFFF ; LDA STRCOL,X
$8D WSYNC ; STA WSYNC
$8D COLPF0 ; STA COLPF0
$EE INDEX ; INC INDEX
$40 ; RTI
]
RETURN
; ***********************************
PROC MAIN()
; fix up ml routines
; by poking in addresses of various arrays
POKEC(dli+4,strcol)
POKEC(scroll+7,strtpl)
POKEC(scroll+12,strtph)
POKEC(scroll+17,strpos)
POKEC(scroll+40,strpos)
POKEC(DLI+1,@index)
strini() ;set up stars
dlsini() ;set up display list
color4=0 ;set background color
SETVBV(7,vblank/256,vblank&255) ; set up vblank
vdslst=dli nmien=192 ; get dli's going
; now just let things run
DO
At line 31 changed one line
OD
RETURN
}}}
At line 34 removed 2 lines