mirror of
https://github.com/dwsJason/gslaplay.git
synced 2025-02-18 00:30:36 +00:00
Player Actually Plays a sample Animation
This commit is contained in:
parent
ef1d637e36
commit
4a2db30d21
@ -15,7 +15,7 @@
|
|||||||
sna start ; segment name
|
sna start ; segment name
|
||||||
*----------------------------------------------
|
*----------------------------------------------
|
||||||
asm play.s
|
asm play.s
|
||||||
ds 0 ; padding
|
ds 0 ; padding
|
||||||
knd #$1100 ; kind
|
knd #$1100 ; kind
|
||||||
ali None ; alignment
|
ali None ; alignment
|
||||||
lna play ; load name
|
lna play ; load name
|
||||||
|
94
asm/play.s
94
asm/play.s
@ -44,55 +44,79 @@
|
|||||||
; rel
|
; rel
|
||||||
dsk play.l
|
dsk play.l
|
||||||
|
|
||||||
|
;
|
||||||
|
; Defines, for the list of allocated memory banks
|
||||||
|
;
|
||||||
|
banks_count equ $80
|
||||||
|
banks_data equ $82
|
||||||
|
|
||||||
|
|
||||||
player ent
|
player ent
|
||||||
org $0
|
org $0
|
||||||
mx %00
|
mx %00
|
||||||
phb
|
phb
|
||||||
sep #$30
|
sep #$20 ; preserve X
|
||||||
sta srcbank+2 ; self modify the code for mvn
|
sta <srcbank+2 ; self modify the code for mvn
|
||||||
sta read_opcode+3 ; data stream reader
|
sta <read_opcode+3 ; data stream reader
|
||||||
sta dictionary_offset+3 ; opcode stream reader
|
sta <dictionary_offset+3 ; opcode stream reader
|
||||||
rep #$31
|
rep #$31
|
||||||
ldy #$2000 ; it's a new frame, cursor starts at beginning of SHR
|
ldy #$2000 ; it's a new frame, cursor starts at beginning of SHR
|
||||||
|
|
||||||
|
stz <banks_index
|
||||||
|
* stz <frames
|
||||||
|
|
||||||
bra read_opcode
|
bra read_opcode
|
||||||
|
*frames dw 0
|
||||||
|
|
||||||
extended_command
|
extended_command
|
||||||
|
beq :source_skip_next_bank
|
||||||
lsr
|
lsr
|
||||||
bcs :not_end_of_frame
|
lsr
|
||||||
|
bcs :end_of_file
|
||||||
|
|
||||||
|
* ; end of frame
|
||||||
ldy #$2000
|
ldy #$2000
|
||||||
; check elapsed ticks (need at least 1)
|
* ; check elapsed ticks (need at least 1)
|
||||||
; For now just inline vsync (preferable to check the number of
|
* ; For now just inline vsync (preferable to check the number of
|
||||||
; if jiffy that have elapsed, because if the animation uses more than
|
* ; if jiffy that have elapsed, because if the animation uses more than
|
||||||
; roughly 10% of the screen we don't want to sync here
|
* ; roughly 10% of the screen we don't want to sync here
|
||||||
|
* lda <frames
|
||||||
|
* inc
|
||||||
|
* sta <frames
|
||||||
|
* cmp #2
|
||||||
|
* bge :end_of_file
|
||||||
|
*
|
||||||
bra read_opcode
|
bra read_opcode
|
||||||
|
|
||||||
:end_of_file
|
:end_of_file
|
||||||
plb ; restore bank
|
plb ; restore bank
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
:not_end_of_frame
|
:source_skip_next_bank
|
||||||
beq :end_of_file
|
*
|
||||||
|
* If data is sequential in memory
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ; source data, new bank
|
||||||
|
* inc <read_opcode+3 ; 6
|
||||||
|
* inc <dictionary_offset+3 ; 6
|
||||||
|
* inc <srcbank+2 ; 6
|
||||||
|
*
|
||||||
|
|
||||||
cmp #1
|
*
|
||||||
bne :not_new_bank
|
* Our Banks of Data are in the order
|
||||||
|
* they were allocated, so this is a little
|
||||||
;sep #$30 ; 3
|
* more complicated
|
||||||
;lda <read_opcode+3 ; 3
|
*
|
||||||
;inc ; 2
|
sep #$20 ; preserve Y, by leaving X long
|
||||||
;sta <read_opcode+3 ; 3
|
ldx <banks_index
|
||||||
;sta <dictionary_offset+3 ; 3
|
inx
|
||||||
;sta <srcbank+2 ; 3
|
stx <banks_index
|
||||||
;rep #$31 ; 3
|
lda <banks_data,x
|
||||||
|
sta <srcbank+2 ; self modify the code for mvn
|
||||||
; source data, new bank
|
sta <read_opcode+3 ; data stream reader
|
||||||
inc <read_opcode+3 ; 6
|
sta <dictionary_offset+3 ; opcode stream reader
|
||||||
inc <dictionary_offset+3 ; 6
|
rep #$31
|
||||||
inc <srcbank+2 ; 6
|
|
||||||
|
|
||||||
; start of new bank
|
; start of new bank
|
||||||
ldx #0
|
ldx #0
|
||||||
@ -119,14 +143,14 @@ dictionary_copy
|
|||||||
lsr
|
lsr
|
||||||
bcs cursor_skip
|
bcs cursor_skip
|
||||||
|
|
||||||
sta temp
|
sta <temp
|
||||||
|
|
||||||
stx dictionary_offset+1
|
stx <dictionary_offset+1
|
||||||
dictionary_offset
|
dictionary_offset
|
||||||
ldal $000000
|
ldal $000000
|
||||||
tax
|
tax
|
||||||
|
|
||||||
lda temp
|
lda <temp
|
||||||
; dictionary copy
|
; dictionary copy
|
||||||
mvn $01,$01
|
mvn $01,$01
|
||||||
|
|
||||||
@ -137,10 +161,12 @@ dictionary_offset
|
|||||||
bra read_opcode
|
bra read_opcode
|
||||||
|
|
||||||
cursor_skip
|
cursor_skip
|
||||||
sty temp
|
sty <skip_amount+1
|
||||||
adc temp
|
skip_amount
|
||||||
|
adc #$0000
|
||||||
tay
|
tay
|
||||||
bra read_opcode
|
bra read_opcode
|
||||||
|
|
||||||
|
banks_index dw 0
|
||||||
temp dw 0
|
temp dw 0
|
||||||
|
|
||||||
|
203
asm/shell.s
203
asm/shell.s
@ -17,6 +17,14 @@
|
|||||||
ext player
|
ext player
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
; Defines, for the list of allocated memory banks
|
||||||
|
;
|
||||||
|
banks_count equ $80
|
||||||
|
banks_data equ $82
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vidmode = $8080 ;Video mode for QD II (320) ($8000)
|
vidmode = $8080 ;Video mode for QD II (320) ($8000)
|
||||||
;640 mode ($8080)
|
;640 mode ($8080)
|
||||||
|
|
||||||
@ -49,6 +57,14 @@ SetRes sep $30 ; 8-bit mode
|
|||||||
pla ;retrieve our program ID
|
pla ;retrieve our program ID
|
||||||
sta ProgID
|
sta ProgID
|
||||||
|
|
||||||
|
;-------------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
; Initialize List of memory Banks
|
||||||
|
;
|
||||||
|
stz <banks_count
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PushLong #0 ;result space
|
PushLong #0 ;result space
|
||||||
lda ProgID ;user ID
|
lda ProgID ;user ID
|
||||||
pha
|
pha
|
||||||
@ -131,6 +147,9 @@ DoMenu
|
|||||||
sta p:rbuf+2
|
sta p:rbuf+2
|
||||||
sta iobuff+2
|
sta iobuff+2
|
||||||
|
|
||||||
|
; A contains bank address to add
|
||||||
|
jsr AddBank
|
||||||
|
|
||||||
|
|
||||||
* PushLong #0
|
* PushLong #0
|
||||||
* PushPtr ExampleM
|
* PushPtr ExampleM
|
||||||
@ -467,8 +486,9 @@ DoOpen
|
|||||||
bcc :lup
|
bcc :lup
|
||||||
|
|
||||||
_Open p:open
|
_Open p:open
|
||||||
bcs :trouble
|
bcc :read_filesize
|
||||||
|
brl :trouble
|
||||||
|
:read_filesize
|
||||||
lda p:open
|
lda p:open
|
||||||
sta p:read
|
sta p:read
|
||||||
sta p:get_eof
|
sta p:get_eof
|
||||||
@ -476,6 +496,7 @@ DoOpen
|
|||||||
_GET_EOF p:get_eof
|
_GET_EOF p:get_eof
|
||||||
bcc :eof_seems_good
|
bcc :eof_seems_good
|
||||||
:err_close
|
:err_close
|
||||||
|
jsr FreeBanks
|
||||||
_Close p:close
|
_Close p:close
|
||||||
bra :trouble
|
bra :trouble
|
||||||
|
|
||||||
@ -497,30 +518,73 @@ DoOpen
|
|||||||
; perhaps loop through, and store a list of allocated banks
|
; perhaps loop through, and store a list of allocated banks
|
||||||
; starting at $80 in the DP, so DP,x addressing can get at
|
; starting at $80 in the DP, so DP,x addressing can get at
|
||||||
; them in the player
|
; them in the player
|
||||||
|
|
||||||
|
; while banks_count < required_banks
|
||||||
lda p:eof
|
|
||||||
ldx p:eof+2
|
lda p:eof+2
|
||||||
jsr getmem
|
inc
|
||||||
bcs :err_close
|
sta :required_banks
|
||||||
|
|
||||||
|
]loop
|
||||||
|
lda <banks_count
|
||||||
|
cmp :required_banks
|
||||||
|
bcs :we_have_memory
|
||||||
|
|
||||||
; jsl dereference
|
; Ask for 64K
|
||||||
; sta p:rbuf
|
lda #$0000
|
||||||
; stx p:rbuf+2
|
ldx #$0001
|
||||||
|
jsr getmem
|
||||||
|
bcs :mem_failed
|
||||||
|
|
||||||
; lda p:eof
|
jsl dereference
|
||||||
; ldx p:eof+2
|
|
||||||
; sta p:rsize
|
|
||||||
; stx p:rsize+2
|
|
||||||
|
|
||||||
; _Read p:read
|
txa
|
||||||
; bcs :err_close
|
jsr AddBank
|
||||||
|
|
||||||
|
bra ]loop
|
||||||
|
|
||||||
|
|
||||||
|
:mem_failed
|
||||||
|
jsr FreeBanks
|
||||||
|
|
||||||
|
; Pop up an Alert
|
||||||
|
|
||||||
|
bra :err_close
|
||||||
|
|
||||||
|
:we_have_memory
|
||||||
|
|
||||||
|
; Read in the File
|
||||||
|
|
||||||
|
; Size 64k at a time
|
||||||
|
stz p:rsize
|
||||||
|
lda #$0001
|
||||||
|
sta p:rsize+2
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
stx p:rbuf+0
|
||||||
|
]read_loop
|
||||||
|
lda <banks_data,x
|
||||||
|
and #$00FF
|
||||||
|
sta p:rbuf+2
|
||||||
|
|
||||||
|
phx
|
||||||
|
_Read p:read
|
||||||
|
plx
|
||||||
|
|
||||||
|
bcs :err_close
|
||||||
|
|
||||||
|
inx
|
||||||
|
cpx :required_banks
|
||||||
|
bcc ]read_loop
|
||||||
|
|
||||||
|
:close_exit
|
||||||
_Close p:close
|
_Close p:close
|
||||||
bcs :trouble
|
bcs :trouble
|
||||||
brl PlayAnimation
|
brl PlayAnimation
|
||||||
|
|
||||||
:temp dw 0
|
:required_banks
|
||||||
|
:temp
|
||||||
|
dw 0
|
||||||
|
|
||||||
:trouble
|
:trouble
|
||||||
pha
|
pha
|
||||||
@ -529,7 +593,6 @@ DoOpen
|
|||||||
jsl $e10000
|
jsl $e10000
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
|
|
||||||
:message str 'Open GS Lzb Anim:'
|
:message str 'Open GS Lzb Anim:'
|
||||||
|
|
||||||
:filter dw 0 ; (count 0/no filter), set to 1 for only show s16 files
|
:filter dw 0 ; (count 0/no filter), set to 1 for only show s16 files
|
||||||
@ -557,52 +620,56 @@ p:where adrl $1c000 ;about 108k into file
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
PlayAnimation
|
PlayAnimation mx %00
|
||||||
rts
|
|
||||||
|
|
||||||
; ha, this has to parse the headers
|
; ha, this has to parse the headers
|
||||||
; before it can play the animation
|
; before it can play the animation
|
||||||
|
|
||||||
; copy player to the Direct Page
|
; copy player to the Direct Page
|
||||||
|
|
||||||
lda #127 ; player is really only about 96 bytes
|
lda #127 ; player is less than 128 bytes
|
||||||
ldx #player
|
ldx #player
|
||||||
phd
|
phd
|
||||||
ply
|
ply
|
||||||
sty :play+1
|
sty :play+1
|
||||||
sty :init+1
|
sty :init+1
|
||||||
|
|
||||||
mvn ^player,$00
|
mvn ^player,$00
|
||||||
|
|
||||||
phk
|
phk
|
||||||
plb
|
plb
|
||||||
|
|
||||||
; Pointer to the INITial Frame Data
|
; Pointer to the INITial Frame Data
|
||||||
lda #28 ; Header of file + Header of INIT Frame
|
lda <banks_data
|
||||||
ldx p:rbuf+2
|
and #$00FF
|
||||||
|
sta $FE
|
||||||
|
|
||||||
|
ldx #28 ; Header of file + Header of INIT Frame
|
||||||
|
|
||||||
|
; X = Low
|
||||||
|
; A = High
|
||||||
|
|
||||||
:init jsl $000000 ; for the first frame
|
:init jsl $000000 ; for the first frame
|
||||||
|
|
||||||
; load up a pointer to data
|
; load up a pointer to data
|
||||||
:loop
|
:loop
|
||||||
lda p:rbuf
|
stz $FC
|
||||||
sta $F0
|
|
||||||
lda p:rbuf+2
|
|
||||||
sta $F2
|
|
||||||
|
|
||||||
ldy #24
|
ldy #24
|
||||||
lda [$F0],y
|
lda [$FC],y
|
||||||
clc
|
clc
|
||||||
adc #20
|
adc #28 ; 20 byte header + 8 bytes skip into the ANIM Block
|
||||||
|
tax
|
||||||
|
|
||||||
;lda p:rbuf
|
lda $FE
|
||||||
ldx p:rbuf+2
|
|
||||||
|
|
||||||
; play the animation
|
; play the animation
|
||||||
|
; X = Low
|
||||||
|
; A = High
|
||||||
|
|
||||||
:play jsl $000000
|
:play jsl $000000
|
||||||
|
|
||||||
bra :loop
|
bra :loop
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -618,3 +685,47 @@ DoClose
|
|||||||
text
|
text
|
||||||
str "Written By: Jason Andersen and Steven Chiang"
|
str "Written By: Jason Andersen and Steven Chiang"
|
||||||
|
|
||||||
|
********************************************************************************
|
||||||
|
*
|
||||||
|
* Append a Bank to the list
|
||||||
|
*
|
||||||
|
AddBank mx %00
|
||||||
|
ldx <banks_count
|
||||||
|
sta <banks_data,x
|
||||||
|
inx
|
||||||
|
stx <banks_count
|
||||||
|
rts
|
||||||
|
|
||||||
|
********************************************************************************
|
||||||
|
*
|
||||||
|
* Free Memory, and Clear Bank List
|
||||||
|
*
|
||||||
|
FreeBanks mx %00
|
||||||
|
|
||||||
|
]loop
|
||||||
|
ldx <banks_count
|
||||||
|
dex
|
||||||
|
bmi :done
|
||||||
|
stx <banks_count
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
phy ; space for result
|
||||||
|
phy
|
||||||
|
|
||||||
|
lda <banks_data,x
|
||||||
|
and #$00FF
|
||||||
|
phy ; memory address high
|
||||||
|
phy ; memory address low
|
||||||
|
|
||||||
|
ldx #$1A02 ; FindHandle
|
||||||
|
jsl tool
|
||||||
|
|
||||||
|
ldx #$1002 ; DisposeHandle
|
||||||
|
jsl tool
|
||||||
|
|
||||||
|
bra ]loop
|
||||||
|
|
||||||
|
:done
|
||||||
|
rts
|
||||||
|
|
||||||
|
rts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user