home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / canada-remote-systems / geos / utils / chaossrc.seq (.txt) < prev    next >
GEOS ConVerT  |  2019-04-13  |  6KB  |  139 lines

  1. CHAOS SRC
  2. SEQ formatted GEOS file V1.0
  3. Comm. Compat.
  4. CHAOS SRC
  5. BLASTER'S CONVERTER V2.5
  6. Chaos.dbg
  7. Write Image V2.1
  8. geoWrite    V2.1
  9. Source to Chaos program.
  10. By Nate Fiedler
  11. ;************************************************
  12. ;    Chaos Triangle Demo    Nate Fiedler
  13. ;    Started:  5/8/92    Finished:  5/8/92
  14. ;************************************************
  15.     .if    Pass1
  16.     .include    geosSym
  17.     .include    natesMac
  18.     .endif
  19. .psect
  20. Start:    jsr    DoInfo    ;display info box
  21.     jsr    InitCode    ;clear variable space
  22.     LoadW    keyVector,DoQuit    ;set up quit routine through keypresses
  23.     LoadW    appMain,DoDemo    ;set up drawing routine in MainLoop vector
  24. .ramsect    ;always use ramsect when defining uninitialized variable space
  25. VARSTART:
  26. k:    .block    1    ;these are unknown values, so you should
  27. r:    .block    1    ;initialize this ram space
  28. VARLEN    = (*-VARSTART)
  29. .psect    ;make sure to turn program section assembly back on
  30. x:    .word    50    ;initial (current) x position of dot to draw
  31. x1:    .word    159    ;top corner
  32. x3:    .word    50    ;left corner
  33. x5:    .word    269    ;right corner
  34. y:    .word    169    ;initial (current) y position
  35. y1:    .word    30    ;top corner
  36. y3:    .word    169    ;left corner
  37. y5:    .word    169    ;right corner
  38. InitCode:    LoadW    r0,dummys    ;ALWAYS set up some sort of icons
  39.     jsr    DoIcons
  40.     LoadB    dispBufferOn,(ST_WR_FORE|ST_WR_BACK)
  41.     lda    #0    ;clear the screen to the blank pattern
  42.     jsr    SetPattern
  43.     jsr    i_Rectangle
  44.     .byte    0,199
  45.     .word    0,319
  46.     jsr    i_FillRam    ;ALWAYS clear uninitialzed variables
  47.     .word    VARLEN
  48.     .word    VARSTART
  49.     .byte    0
  50.     jmp    RndInit    ;initialize random number registers in SID chip
  51. dummys:    .byte    1,0,0,0,0,0,0,0,1,1,0,0    ;dummy icon table
  52. DoInfo:    LoadW    r0,infobox
  53.     jmp    DoDlgBox
  54. infobox:    .byte    DEF_DB_POS|1,DBTXTSTR,16,16
  55.     .word    info1text
  56.     .byte    DBTXTSTR,16,32    ;note how I squeeze everything onto one line
  57.     .word    info2text
  58.     .byte    DBTXTSTR,16,48
  59.     .word    info3text
  60.     .byte    OK,9,72,0
  61. info1text:    .byte    BOLDON,"Chaos Triangle Demo",PLAINTEXT,0
  62. info2text:    .byte    "By Nate Fiedler",0
  63. info3text:    .byte    "Originally by Mike Traum in BASIC.",0
  64. ight corner
  65. y:    .word    169    ;initial (current) y position
  66. y1:    .word    30    ;top corner
  67. y3:    .word    169    ;left corner
  68. y5:    .word    169    ;right corner
  69. ;I usually shut of interr
  70. DoDemo:    ;this is the actual triangle drawing routine
  71. 5$:    jsr    DoRandom    ;get a random number
  72.     LoadB    k,1    ;loop from 1 to 3
  73. 6$:    CmpB    k,r    ;compare to random number
  74.     beq    10$    ;if match, then update x and y with new position
  75.     add    #1
  76.     cmp    r    ;check for even numbered random number
  77.     beq    10$
  78.     inc    k    ;no match, add two to check next set of positions
  79.     inc    k
  80.     bne    6$
  81. 10$:    ldy    k    ;retrieve odd numbered loop count
  82.     lda    x+1,y    ;load either x1, x3, or x5 and add to x
  83.     add    x
  84.     sta    x
  85.     lda    x+2,y
  86.     adc    x+1
  87.     sta    x+1
  88.     lsr    x+1    ;divide by two by shifting the bits right once
  89.     ror    x    ;two find average of the two x's, X=(X+X(k))/2
  90.     lda    y+1,y    ;loads in either y1, y3, or y5 using the y index register
  91.     add    y
  92.     sta    y    ;find new y position
  93.     lda    y+2,y
  94.     adc    y+1
  95.     sta    y+1
  96.     lsr    y+1
  97.     ror    y    ;and divide it by two as well, Y=(Y+Y(k))/2
  98.     jmp    DrawDot    ;draw the dot on the screen
  99. DoQuit:    jmp    EnterDeskTop    ;our quit routine
  100. RndInit:    php    ;notice that I save the status flag so I can recover it later
  101.     sei    ;I usually shut of interrupts when changing CPU_DATA
  102.     PushB    CPU_DATA    ;also save CPU_DATA when changing
  103.     LoadB    CPU_DATA,IO_IN
  104.     LoadB    sidbase+$0f,$ff    ;set voice 3 to highest frequency
  105.     LoadB    sidbase+$12,$80    ;set voice 3 to noise waveform (random numbers!)
  106.     sta    sidbase+$18    ;set voice 3 cut-off and filter and turn off volume
  107.     PopB    CPU_DATA
  108. DrawDot:    MoveW    x,r3
  109.     MoveB    y,r11L
  110.     lda    #0
  111.     jmp    DrawPoint
  112. DoRandom: php    ;save interrupt disable flag status
  113.     sei    ;set to no-interrups
  114.     PushB    CPU_DATA
  115.     LoadB    CPU_DATA,IO_IN    ;map in IO registers
  116. 5$:    lda    sidbase+$1b    ;get oscillator 3 random number generator
  117.     beq    5$
  118.     cmp    #7    ;we only want something from 1 to 6
  119.     bcs    5$
  120.     sta    r    ;store it
  121.     PopB    CPU_DATA    ;restore bank map
  122.     plp        ;restore i status
  123.  status
  124. , or x5 and add to x
  125.     add    x
  126.     sta    x
  127.     lda    x+2,y
  128. ;I always like to have two carriage returns on a blank page at the end of my source code
  129. adB    k,1    ;loop from 1 to 3
  130. 6$:    CmpB    k,r    ;compare to random number
  131.     beq    10$    ;if match, then update x and y with new position
  132. *******************************************
  133. ;    Chaos Triangle Demo    Nate Fiedler
  134. ;    Started:  5/8/92    Finished:  5/8/92
  135. ;************************************************
  136.     .if    Pass1
  137.     .include    geosSym
  138.     .include    natesMac
  139.