mirror of
https://github.com/option8/greenscale.git
synced 2025-01-14 02:30:20 +00:00
slideshow function with multiple data files
This commit is contained in:
parent
47c83414e3
commit
54e1c13ae5
171
GREENSCALE.s
171
GREENSCALE.s
@ -4,9 +4,9 @@
|
||||
* Low res monochrome image display
|
||||
*
|
||||
* to do:
|
||||
* interframe delay, based on keypress
|
||||
* multiple emulator detection, different color tables
|
||||
* GS/large RAM version to load MOAR data.
|
||||
* large volume version, load several animations, loop between them on keypress
|
||||
**************************************************
|
||||
* Variables
|
||||
**************************************************
|
||||
@ -31,6 +31,8 @@ DELAY EQU $1F ; interframe delay amount.
|
||||
; FF=3FPS $80=10FPS $40=24FPS $20=37FPS $10=43FPS $00=46FPS
|
||||
PAUSED EQU $20 ; paused state - stop animation
|
||||
|
||||
COLORMODE EQU $22 ; which color mode are we in? which table to draw from
|
||||
|
||||
**************************************************
|
||||
* Apple Standard Memory Locations
|
||||
**************************************************
|
||||
@ -87,7 +89,7 @@ CLOSECMD EQU $CC ; CLOSE command index
|
||||
* START - sets up various fiddly zero page bits
|
||||
**************************************************
|
||||
|
||||
ORG $2000 ; PROGRAM DATA STARTS AT $2000
|
||||
ORG $0800 ; PROGRAM DATA STARTS AT $0C00 NOW
|
||||
|
||||
JSR BLOAD ; BLOAD DATA
|
||||
|
||||
@ -103,12 +105,13 @@ CLOSECMD EQU $CC ; CLOSE command index
|
||||
STA MIXCLR ; For IIGS - bottom 4 lines to GR
|
||||
|
||||
STA PAUSED ; start not paused
|
||||
|
||||
STA COLORMODE ; start in default, real hardware mode
|
||||
|
||||
lda #$01 ; disable SHR for IIgs
|
||||
sta $c029 ; re: John Brooks
|
||||
|
||||
STA DELAY ; start with delay = 1
|
||||
LDA #$30
|
||||
STA DELAY ; start with a modest 30FPS
|
||||
|
||||
lda SETAN3
|
||||
sta CLR80VID ; turn 80 column off
|
||||
@ -118,17 +121,15 @@ CLOSECMD EQU $CC ; CLOSE command index
|
||||
|
||||
JSR EMULATORCHECK ; check for Virtual II, MicroM8?
|
||||
|
||||
BCS STARTANIMATION ; running in VII, go ahead.
|
||||
|
||||
JSR COLORSWAP ; otherwise, swap the color table
|
||||
*** to do
|
||||
|
||||
BCC STARTANIMATION ; not running in VII, go ahead.
|
||||
|
||||
JSR COLORSWAP ; otherwise, swap the color table (#1 is VII)
|
||||
|
||||
**************************************************
|
||||
* MAIN LOOP
|
||||
**************************************************
|
||||
|
||||
STARTANIMATION
|
||||
STARTANIMATION
|
||||
LDA DATAHI ; image data starts at end of code.
|
||||
STA IMGHI
|
||||
LDA DATALO
|
||||
@ -137,7 +138,7 @@ STARTANIMATION
|
||||
STA FRAMENUM ; frame #0
|
||||
|
||||
EACHFRAME JSR INTERFRAMEDELAY
|
||||
;LDX #$00
|
||||
LDX #$00
|
||||
STX PLOTROW
|
||||
LDY #$27 ; Y IS PLOTCOLUMN
|
||||
|
||||
@ -205,6 +206,17 @@ CHECKDELAY LDA KEY ; check for keydown
|
||||
CMP #$AD ; minus
|
||||
BEQ DECDELAY ; if EQ, speed up (DEC DELAY)
|
||||
|
||||
CMP #$C3 ; c
|
||||
BEQ SWITCHCOLOR ; if C switch color mode
|
||||
CMP #$E3 ; C
|
||||
BEQ SWITCHCOLOR ; if C switch color mode
|
||||
|
||||
CMP #$CE ; N
|
||||
BEQ SWITCHDATA ; go to next DATA0* file
|
||||
CMP #$EE ; N
|
||||
BEQ SWITCHDATA ; go to next DATA0* file
|
||||
|
||||
|
||||
XLOOP LDX DELAY ; typical delay loop
|
||||
|
||||
DELAYLOOP LDY DELAY
|
||||
@ -231,6 +243,14 @@ DECDELAY STA STROBE
|
||||
DEC DELAY
|
||||
JMP XLOOP
|
||||
|
||||
SWITCHCOLOR STA STROBE
|
||||
JSR COLORSWAP
|
||||
JMP XLOOP
|
||||
|
||||
SWITCHDATA STA STROBE
|
||||
JSR NEXTFILE
|
||||
RTS
|
||||
|
||||
|
||||
**************************************************
|
||||
* Check to see if I'm running in Virtual II or
|
||||
@ -261,15 +281,13 @@ FOUNDVII
|
||||
|
||||
BLOAD JSR OPEN ;open "DATA"
|
||||
JSR READ
|
||||
JSR ERROR
|
||||
JSR CLOSE
|
||||
JSR ERROR
|
||||
RTS ;Otherwise done
|
||||
|
||||
OPEN JSR MLI ;Perform call
|
||||
DB OPENCMD ;CREATE command number
|
||||
DW OPENLIST ;Pointer to parameter list
|
||||
JSR ERROR ;If error, display it
|
||||
BNE ERROR ;If error, display it
|
||||
LDA REFERENCE
|
||||
STA READLIST+1
|
||||
STA CLOSELIST+1
|
||||
@ -278,21 +296,28 @@ OPEN JSR MLI ;Perform call
|
||||
READ JSR MLI
|
||||
DB READCMD
|
||||
DW READLIST
|
||||
BNE ERROR
|
||||
RTS
|
||||
|
||||
CLOSE JSR MLI
|
||||
DB CLOSECMD
|
||||
DW CLOSELIST
|
||||
BNE ERROR
|
||||
RTS
|
||||
|
||||
ERROR JSR PRBYTE ;Print error code
|
||||
ERROR CMP #$46 ; file not found during OPEN? reset to "DATA00"
|
||||
BNE PRINTERROR
|
||||
LDA #$30
|
||||
STA ENDNAME-1
|
||||
JMP OPEN
|
||||
PRINTERROR JSR PRBYTE ;Print error code
|
||||
JSR BELL ;Ring the bell
|
||||
JSR CROUT ;Print a carriage return
|
||||
RTS
|
||||
|
||||
OPENLIST DB $03 ; parameter list for OPEN command
|
||||
DW FILENAME
|
||||
DB $00,$08 ; buffer at $800 ?
|
||||
DA MLI-$400 ; buffer snuggled up tight with PRODOS
|
||||
REFERENCE DB $00 ; reference to opened file
|
||||
|
||||
READLIST DB $04
|
||||
@ -305,7 +330,7 @@ CLOSELIST DB $01
|
||||
DB $00
|
||||
|
||||
FILENAME DB ENDNAME-NAME ;Length of name
|
||||
NAME ASC '/GREENSCALE/DATA' ;followed by the name
|
||||
NAME ASC '/GREENSCALE/DATA00' ;followed by the name
|
||||
ENDNAME EQU *
|
||||
|
||||
|
||||
@ -331,11 +356,42 @@ HOWMANYSET INX
|
||||
* This works because the color tables are $FF bytes long.
|
||||
**************************************************
|
||||
|
||||
COLORSWAP
|
||||
LDA THREEGRAYSHI ; hi byte of ALTCOLORTABLE address
|
||||
COLORSWAP INC COLORMODE ; next mode to cycle through
|
||||
|
||||
LDX COLORMODE ; load to X
|
||||
CPX #$05 ; is it now the text mode?
|
||||
BEQ TEXTSWAP
|
||||
; otherwise, be sure to be back in GR
|
||||
STX LORES ; low res graphics mode
|
||||
STX MIXCLR ; For IIGS - bottom 4 lines to GR
|
||||
|
||||
CPX #$06 ; overrun, back to zero
|
||||
BNE SWAPTABLE
|
||||
LDX #$0
|
||||
STX COLORMODE
|
||||
|
||||
SWAPTABLE LDA COLORMODESTABLE,X ; grab table address from LUT
|
||||
STA WHICHTABLE+2 ; put it in the code
|
||||
RTS
|
||||
|
||||
|
||||
TEXTSWAP STA TXTSET ; set text mode
|
||||
JMP SWAPTABLE
|
||||
|
||||
**************************************************
|
||||
* Increment the name of the file to be loaded
|
||||
* then trigger the load again.
|
||||
**************************************************
|
||||
NEXTFILE LDY ENDNAME-1 ; last char in ascii filename "DATA00" = #$30
|
||||
INY
|
||||
CPY #$3A ; roll over past "9"?
|
||||
BNE SETFILE
|
||||
LDY #$30 ; reset to "0"
|
||||
SETFILE STY ENDNAME-1
|
||||
JSR BLOAD
|
||||
JSR HOWMANYFRAMES ; how big is the new animation data?
|
||||
LDA #$01
|
||||
STA FRAMENUM ; start new anim at frame 0
|
||||
RTS
|
||||
|
||||
**************************************************
|
||||
* Data Tables
|
||||
@ -347,7 +403,25 @@ COLORSWAP
|
||||
*
|
||||
**************************************************
|
||||
|
||||
COLORTABLE HEX 00,02,06,01,04,05,08,03,0C,09,07,0A,0B,0E,0D,0F ; Low res colors from darkest to lightest for Virtual ][
|
||||
|
||||
COLORTABLE HEX 00,02,01,04,08,03,06,0C,09,05,0A,07,0B,0E,0D,0F ; for OpenEmulator, real hardware.
|
||||
HEX 20,22,21,24,28,23,26,2C,29,25,2A,27,2B,2E,2D,2F
|
||||
HEX 10,12,11,14,18,13,16,1C,19,15,1A,17,1B,1E,1D,1F
|
||||
HEX 40,42,41,44,48,43,46,4C,49,45,4A,47,4B,4E,4D,4F
|
||||
HEX 80,82,81,84,88,83,86,8C,89,85,8A,87,8B,8E,8D,8F
|
||||
HEX 30,32,31,34,38,33,36,3C,39,35,3A,37,3B,3E,3D,3F
|
||||
HEX 60,62,61,64,68,63,66,6C,69,65,6A,67,6B,6E,6D,6F
|
||||
HEX c0,c2,c1,c4,c8,c3,c6,cC,c9,c5,cA,c7,cB,cE,cD,cF
|
||||
HEX 90,92,91,94,98,93,96,9C,99,95,9A,97,9B,9E,9D,9F
|
||||
HEX 50,52,51,54,58,53,56,5C,59,55,5A,57,5B,5E,5D,5F
|
||||
HEX A0,A2,A1,A4,A8,A3,A6,AC,A9,A5,AA,A7,AB,AE,AD,AF
|
||||
HEX 70,72,71,74,78,73,76,7C,79,75,7A,77,7B,7E,7D,7F
|
||||
HEX B0,B2,B1,B4,B8,B3,B6,BC,B9,B5,BA,B7,BB,BE,BD,BF
|
||||
HEX E0,E2,E1,E4,E8,E3,E6,EC,E9,E5,EA,E7,EB,EE,ED,EF
|
||||
HEX D0,D2,D1,D4,D8,D3,D6,DC,D9,D5,DA,D7,DB,DE,DD,DF
|
||||
HEX F0,F2,F1,F4,F8,F3,F6,FC,F9,F5,FA,F7,FB,FE,FD,FF
|
||||
|
||||
V2COLORTABLE HEX 00,02,06,01,04,05,08,03,0C,09,07,0A,0B,0E,0D,0F ; Low res colors from darkest to lightest for Virtual ][
|
||||
HEX 20,22,26,21,24,25,28,23,2C,29,27,2A,2B,2E,2D,2F
|
||||
HEX 60,62,66,61,64,65,68,63,6C,69,67,6A,6B,6E,6D,6F
|
||||
HEX 10,12,16,11,14,15,18,13,1C,19,17,1A,1B,1E,1D,1F
|
||||
@ -382,14 +456,61 @@ THREEGRAYSTABLE HEX 00,02,02,02,02,06,06,06,06,06,06,07,07,07,07,0F ; W/B and 3
|
||||
HEX 70,72,72,72,72,76,76,76,76,76,76,77,77,77,77,7F
|
||||
HEX F0,F2,F2,F2,F2,F6,F6,F6,F6,F6,F6,F7,F7,F7,F7,FF
|
||||
|
||||
;ALTCOLORTABLE HEX 00,02,01,04,08,03,06,0C,09,05,0A,07,0B,0E,0D,0F ; for OpenEmulator, real hardware.
|
||||
|
||||
;MICROM8 HEX 00,02,04,08,0C,01,09,05,06,0E,0D,03,0A,07,0B,0F
|
||||
MICROM8 HEX 00,02,04,08,0C,01,09,05,06,0E,0D,03,0A,07,0B,0F
|
||||
HEX 20,22,24,28,2C,21,29,25,26,2E,2D,23,2A,27,2B,2F
|
||||
HEX 40,42,44,48,4C,41,49,45,46,4E,4D,43,4A,47,4B,4F
|
||||
HEX 80,82,84,88,8C,81,89,85,86,8E,8D,83,8A,87,8B,8F
|
||||
HEX C0,C2,C4,C8,CC,C1,C9,C5,C6,CE,CD,C3,CA,C7,CB,CF
|
||||
HEX 10,12,14,18,1C,11,19,15,16,1E,1D,13,1A,17,1B,1F
|
||||
HEX 90,92,94,98,9C,91,99,95,96,9E,9D,93,9A,97,9B,9F
|
||||
HEX 50,52,54,58,5C,51,59,55,56,5E,5D,53,5A,57,5B,5F
|
||||
HEX 60,62,64,68,6C,61,69,65,66,6E,6D,63,6A,67,6B,6F
|
||||
HEX E0,E2,E4,E8,EC,E1,E9,E5,E6,EE,ED,E3,EA,E7,EB,EF
|
||||
HEX D0,D2,D4,D8,DC,D1,D9,D5,D6,DE,DD,D3,DA,D7,DB,DF
|
||||
HEX 30,32,34,38,3C,31,39,35,36,3E,3D,33,3A,37,3B,3F
|
||||
HEX A0,A2,A4,A8,AC,A1,A9,A5,A6,AE,AD,A3,AA,A7,AB,AF
|
||||
HEX 70,72,74,78,7C,71,79,75,76,7E,7D,73,7A,77,7B,7F
|
||||
HEX B0,B2,B4,B8,BC,B1,B9,B5,B6,BE,BD,B3,BA,B7,BB,BF
|
||||
HEX F0,F2,F4,F8,FC,F1,F9,F5,F6,FE,FD,F3,FA,F7,FB,FF
|
||||
|
||||
;VIDHD HEX 00,02,01,04,08,03,09,05,0A,06,0C,07,0B,0E,0D,0F
|
||||
VIDHD HEX 00,02,01,04,08,03,09,05,0A,06,0C,07,0B,0E,0D,0F
|
||||
HEX 20,22,21,24,28,23,29,25,2A,26,2C,27,2B,2E,2D,2F
|
||||
HEX 10,12,11,14,18,13,19,15,1A,16,1C,17,1B,1E,1D,1F
|
||||
HEX 40,42,41,44,48,43,49,45,4A,46,4C,47,4B,4E,4D,4F
|
||||
HEX 80,82,81,84,88,83,89,85,8A,86,8C,87,8B,8E,8D,8F
|
||||
HEX 30,32,31,34,38,33,39,35,3A,36,3C,37,3B,3E,3D,3F
|
||||
HEX 90,92,91,94,98,93,99,95,9A,96,9C,97,9B,9E,9D,9F
|
||||
HEX 50,52,51,54,58,53,59,55,5A,56,5C,57,5B,5E,5D,5F
|
||||
HEX A0,A2,A1,A4,A8,A3,A9,A5,AA,A6,AC,A7,AB,AE,AD,AF
|
||||
HEX 60,62,61,64,68,63,69,65,6A,66,6C,67,6B,6E,6D,6F
|
||||
HEX C0,C2,C1,C4,C8,C3,C9,C5,CA,C6,CC,C7,CB,CE,CD,CF
|
||||
HEX 70,72,71,74,78,73,79,75,7A,76,7C,77,7B,7E,7D,7F
|
||||
HEX B0,B2,B1,B4,B8,B3,B9,B5,BA,B6,BC,B7,BB,BE,BD,BF
|
||||
HEX E0,E2,E1,E4,E8,E3,E9,E5,EA,E6,EC,E7,EB,EE,ED,EF
|
||||
HEX D0,D2,D1,D4,D8,D3,D9,D5,DA,D6,DC,D7,DB,DE,DD,DF
|
||||
HEX F0,F2,F1,F4,F8,F3,F9,F5,FA,F6,FC,F7,FB,FE,FD,FF
|
||||
|
||||
TEXTTABLE ASC " '''````~~~^^",A2,A2 ; Low res colors from darkest to lightest for Virtual ][
|
||||
ASC "..'''````~~~^^",A2,A2 ; A2 = ""
|
||||
ASC "..''~^!ll/?TYYFF"
|
||||
ASC ",,''!ll??TTYY7FF"
|
||||
ASC ",,''!l??TYYY74FF"
|
||||
ASC "__'!/llLI?7499PP"
|
||||
ASC "--'!/lLII?7499PP"
|
||||
ASC "::!/l)>LJJ7499PP"
|
||||
ASC ";;!/l)>CC66999RR"
|
||||
ASC "ii/11)>CCOO999RR"
|
||||
ASC "iil11UUZQGB988RR"
|
||||
ASC "vv1]]EEZQGB888RR"
|
||||
ASC "uu1]]WWZQGB888@@"
|
||||
ASC "oo[[[}}}JJNNMM@@"
|
||||
ASC "wwhhddbbkkKK##**"
|
||||
ASC "mmhhddbbkkKK##&*"
|
||||
|
||||
|
||||
THREEGRAYSHI db >THREEGRAYSTABLE
|
||||
|
||||
COLORMODESTABLE db >COLORTABLE,>V2COLORTABLE,>THREEGRAYSTABLE,>MICROM8,>VIDHD,>TEXTTABLE
|
||||
|
||||
FRAMESTABLE HEX 03,07,0B,0F,12,16,1A,1E,21,25,29,2D,30,34,38,3C ; how many frames transferred? HI byte lookup table
|
||||
HEX 3F,43,47,4B,4E,52,56,5A,5D,61,65,69,6C,70,74,78
|
||||
|
Loading…
x
Reference in New Issue
Block a user