home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
canada-remote-systems
/
geos
/
utils
/
chaossrc.seq
(
.txt
)
< prev
next >
Wrap
GEOS ConVerT
|
2019-04-13
|
6KB
|
139 lines
CHAOS SRC
SEQ formatted GEOS file V1.0
Comm. Compat.
CHAOS SRC
BLASTER'S CONVERTER V2.5
Chaos.dbg
Write Image V2.1
geoWrite V2.1
Source to Chaos program.
By Nate Fiedler
;************************************************
; Chaos Triangle Demo Nate Fiedler
; Started: 5/8/92 Finished: 5/8/92
;************************************************
.if Pass1
.include geosSym
.include natesMac
.endif
.psect
Start: jsr DoInfo ;display info box
jsr InitCode ;clear variable space
LoadW keyVector,DoQuit ;set up quit routine through keypresses
LoadW appMain,DoDemo ;set up drawing routine in MainLoop vector
.ramsect ;always use ramsect when defining uninitialized variable space
VARSTART:
k: .block 1 ;these are unknown values, so you should
r: .block 1 ;initialize this ram space
VARLEN = (*-VARSTART)
.psect ;make sure to turn program section assembly back on
x: .word 50 ;initial (current) x position of dot to draw
x1: .word 159 ;top corner
x3: .word 50 ;left corner
x5: .word 269 ;right corner
y: .word 169 ;initial (current) y position
y1: .word 30 ;top corner
y3: .word 169 ;left corner
y5: .word 169 ;right corner
InitCode: LoadW r0,dummys ;ALWAYS set up some sort of icons
jsr DoIcons
LoadB dispBufferOn,(ST_WR_FORE|ST_WR_BACK)
lda #0 ;clear the screen to the blank pattern
jsr SetPattern
jsr i_Rectangle
.byte 0,199
.word 0,319
jsr i_FillRam ;ALWAYS clear uninitialzed variables
.word VARLEN
.word VARSTART
.byte 0
jmp RndInit ;initialize random number registers in SID chip
dummys: .byte 1,0,0,0,0,0,0,0,1,1,0,0 ;dummy icon table
DoInfo: LoadW r0,infobox
jmp DoDlgBox
infobox: .byte DEF_DB_POS|1,DBTXTSTR,16,16
.word info1text
.byte DBTXTSTR,16,32 ;note how I squeeze everything onto one line
.word info2text
.byte DBTXTSTR,16,48
.word info3text
.byte OK,9,72,0
info1text: .byte BOLDON,"Chaos Triangle Demo",PLAINTEXT,0
info2text: .byte "By Nate Fiedler",0
info3text: .byte "Originally by Mike Traum in BASIC.",0
ight corner
y: .word 169 ;initial (current) y position
y1: .word 30 ;top corner
y3: .word 169 ;left corner
y5: .word 169 ;right corner
;I usually shut of interr
DoDemo: ;this is the actual triangle drawing routine
5$: jsr DoRandom ;get a random number
LoadB k,1 ;loop from 1 to 3
6$: CmpB k,r ;compare to random number
beq 10$ ;if match, then update x and y with new position
add #1
cmp r ;check for even numbered random number
beq 10$
inc k ;no match, add two to check next set of positions
inc k
bne 6$
10$: ldy k ;retrieve odd numbered loop count
lda x+1,y ;load either x1, x3, or x5 and add to x
add x
sta x
lda x+2,y
adc x+1
sta x+1
lsr x+1 ;divide by two by shifting the bits right once
ror x ;two find average of the two x's, X=(X+X(k))/2
lda y+1,y ;loads in either y1, y3, or y5 using the y index register
add y
sta y ;find new y position
lda y+2,y
adc y+1
sta y+1
lsr y+1
ror y ;and divide it by two as well, Y=(Y+Y(k))/2
jmp DrawDot ;draw the dot on the screen
DoQuit: jmp EnterDeskTop ;our quit routine
RndInit: php ;notice that I save the status flag so I can recover it later
sei ;I usually shut of interrupts when changing CPU_DATA
PushB CPU_DATA ;also save CPU_DATA when changing
LoadB CPU_DATA,IO_IN
LoadB sidbase+$0f,$ff ;set voice 3 to highest frequency
LoadB sidbase+$12,$80 ;set voice 3 to noise waveform (random numbers!)
sta sidbase+$18 ;set voice 3 cut-off and filter and turn off volume
PopB CPU_DATA
DrawDot: MoveW x,r3
MoveB y,r11L
lda #0
jmp DrawPoint
DoRandom: php ;save interrupt disable flag status
sei ;set to no-interrups
PushB CPU_DATA
LoadB CPU_DATA,IO_IN ;map in IO registers
5$: lda sidbase+$1b ;get oscillator 3 random number generator
beq 5$
cmp #7 ;we only want something from 1 to 6
bcs 5$
sta r ;store it
PopB CPU_DATA ;restore bank map
plp ;restore i status
status
, or x5 and add to x
add x
sta x
lda x+2,y
;I always like to have two carriage returns on a blank page at the end of my source code
adB k,1 ;loop from 1 to 3
6$: CmpB k,r ;compare to random number
beq 10$ ;if match, then update x and y with new position
*******************************************
; Chaos Triangle Demo Nate Fiedler
; Started: 5/8/92 Finished: 5/8/92
;************************************************
.if Pass1
.include geosSym
.include natesMac