mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2025-02-19 13:30:30 +00:00
Allocate all memory for the blitters and update message to display the banks
This commit is contained in:
parent
02bd63cf36
commit
9d247f0760
148
test/App.Init.s
148
test/App.Init.s
@ -14,77 +14,88 @@
|
|||||||
; - 1 page for pointer to the second background
|
; - 1 page for pointer to the second background
|
||||||
; - 8 pages for the dynamic tiles
|
; - 8 pages for the dynamic tiles
|
||||||
|
|
||||||
mx %00
|
mx %00
|
||||||
|
|
||||||
MemInit PushLong #0 ; space for result
|
MemInit PushLong #0 ; space for result
|
||||||
PushLong #$008000 ; size (32k)
|
PushLong #$008000 ; size (32k)
|
||||||
PushWord UserId
|
PushWord UserId
|
||||||
PushWord #%11000000_00010111 ; Fixed location
|
PushWord #%11000000_00010111 ; Fixed location
|
||||||
PushLong #$002000
|
PushLong #$002000
|
||||||
_NewHandle ; returns LONG Handle on stack
|
_NewHandle ; returns LONG Handle on stack
|
||||||
plx ; base address of the new handle
|
plx ; base address of the new handle
|
||||||
pla ; high address 00XX of the new handle (bank)
|
pla ; high address 00XX of the new handle (bank)
|
||||||
_Deref
|
_Deref
|
||||||
stx Buff00
|
stx Buff00
|
||||||
sta Buff00+2
|
sta Buff00+2
|
||||||
|
|
||||||
PushLong #0 ; space for result
|
PushLong #0 ; space for result
|
||||||
PushLong #$008000 ; size (32k)
|
PushLong #$008000 ; size (32k)
|
||||||
PushWord UserId
|
PushWord UserId
|
||||||
PushWord #%11000000_00010111 ; Fixed location
|
PushWord #%11000000_00010111 ; Fixed location
|
||||||
PushLong #$012000
|
PushLong #$012000
|
||||||
_NewHandle ; returns LONG Handle on stack
|
_NewHandle ; returns LONG Handle on stack
|
||||||
plx ; base address of the new handle
|
plx ; base address of the new handle
|
||||||
pla ; high address 00XX of the new handle (bank)
|
pla ; high address 00XX of the new handle (bank)
|
||||||
_Deref
|
_Deref
|
||||||
stx Buff01
|
stx Buff01
|
||||||
sta Buff01+2
|
sta Buff01+2
|
||||||
|
|
||||||
PushLong #0 ; space for result
|
PushLong #0 ; space for result
|
||||||
PushLong #$000A00 ; size (10 pages)
|
PushLong #$000A00 ; size (10 pages)
|
||||||
PushWord UserId
|
PushWord UserId
|
||||||
PushWord #%11000000_00010101 ; Page-aligned, fixed bank
|
PushWord #%11000000_00010101 ; Page-aligned, fixed bank
|
||||||
PushLong #$000000
|
PushLong #$000000
|
||||||
_NewHandle ; returns LONG Handle on stack
|
_NewHandle ; returns LONG Handle on stack
|
||||||
plx ; base address of the new handle
|
plx ; base address of the new handle
|
||||||
pla ; high address 00XX of the new handle (bank)
|
pla ; high address 00XX of the new handle (bank)
|
||||||
_Deref
|
_Deref
|
||||||
stx ZeroPage
|
stx ZeroPage
|
||||||
sta ZeroPage+2
|
sta ZeroPage+2
|
||||||
|
|
||||||
PushLong #0
|
; Allocate the 13 banks of memory we need
|
||||||
PushLong #$10000
|
]step equ 0
|
||||||
PushWord UserId
|
lup 13
|
||||||
PushWord #%11000000_00011100
|
jsr AllocOneBank2
|
||||||
PushLong #0
|
sta BlitBuff+]step+2
|
||||||
_NewHandle
|
stz BlitBuff+]step
|
||||||
plx ; base address of the new handle
|
]step equ ]step+4
|
||||||
pla ; high address 00XX of the new handle (bank)
|
--^
|
||||||
_Deref
|
|
||||||
stx BlitBuff
|
|
||||||
sta BlitBuff+2
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
Buff00 ds 4
|
Buff00 ds 4
|
||||||
Buff01 ds 4
|
Buff01 ds 4
|
||||||
ZeroPage ds 4
|
ZeroPage ds 4
|
||||||
BlitBuff ds 4
|
|
||||||
|
;
|
||||||
|
BlitBuff ds 4*13
|
||||||
|
|
||||||
; Bank allocator (for one full, fixed bank of memory. Can be immediately deferenced)
|
; Bank allocator (for one full, fixed bank of memory. Can be immediately deferenced)
|
||||||
|
|
||||||
AllocOneBank PushLong #0
|
AllocOneBank PushLong #0
|
||||||
PushLong #$10000
|
PushLong #$10000
|
||||||
PushWord UserId
|
PushWord UserId
|
||||||
PushWord #%11000000_00011100
|
PushWord #%11000000_00011100
|
||||||
PushLong #0
|
PushLong #0
|
||||||
_NewHandle ; returns LONG Handle on stack
|
_NewHandle ; returns LONG Handle on stack
|
||||||
plx ; base address of the new handle
|
plx ; base address of the new handle
|
||||||
pla ; high address 00XX of the new handle (bank)
|
pla ; high address 00XX of the new handle (bank)
|
||||||
xba ; swap accumulator bytes to XX00
|
xba ; swap accumulator bytes to XX00
|
||||||
sta :bank+2 ; store as bank for next op (overwrite $XX00)
|
sta :bank+2 ; store as bank for next op (overwrite $XX00)
|
||||||
:bank ldal $000001,X ; recover the bank address in A=XX/00
|
:bank ldal $000001,X ; recover the bank address in A=XX/00
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
; Variation that return pointer in the X/A registers (X = low, A = high)
|
||||||
|
AllocOneBank2 PushLong #0
|
||||||
|
PushLong #$10000
|
||||||
|
PushWord UserId
|
||||||
|
PushWord #%11000000_00011100
|
||||||
|
PushLong #0
|
||||||
|
_NewHandle
|
||||||
|
plx ; base address of the new handle
|
||||||
|
pla ; high address 00XX of the new handle (bank)
|
||||||
|
_Deref
|
||||||
|
rts
|
||||||
|
|
||||||
; Set up the interrupts
|
; Set up the interrupts
|
||||||
;
|
;
|
||||||
@ -92,12 +103,21 @@ AllocOneBank PushLong #0
|
|||||||
; SetVector( oneSecHnd, (Pointer) ONEHANDLER );
|
; SetVector( oneSecHnd, (Pointer) ONEHANDLER );
|
||||||
; IntSource( oSecEnable );
|
; IntSource( oSecEnable );
|
||||||
; SetHeartBeat( VBLTASK );
|
; SetHeartBeat( VBLTASK );
|
||||||
IntInit rts
|
IntInit rts
|
||||||
|
|
||||||
|
|
||||||
; IntSource( oSecDisable ); /* disable one second interrupts */
|
; IntSource( oSecDisable ); /* disable one second interrupts */
|
||||||
; SetVector( oneSecHnd, oldOneVect ); /* reset to the old handler */
|
; SetVector( oneSecHnd, oldOneVect ); /* reset to the old handler */
|
||||||
ShutDown rts
|
ShutDown rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
160
test/App.Main.s
160
test/App.Main.s
@ -1,4 +1,16 @@
|
|||||||
; Test program for graphics stufff...
|
; Test program for graphics stufff...
|
||||||
|
;
|
||||||
|
; Allow dynamic resizing to benchmark against different games
|
||||||
|
;
|
||||||
|
; 1. Full Screen : 320 x 200 (32,000 bytes (100.0%))
|
||||||
|
; 2. Sword of Sodan : 272 x 192 (26,112 bytes ( 81.6%))
|
||||||
|
; 3. ~NES : 256 x 200 (25,600 bytes ( 80.0%))
|
||||||
|
; 4. Task Force : 256 x 176 (22,528 bytes ( 70.4%))
|
||||||
|
; 5. Defender of the World : 280 x 160 (22,400 bytes ( 70.0%))
|
||||||
|
; 6. Rastan : 256 x 160 (20,480 bytes ( 64.0%))
|
||||||
|
; 7. Game Boy Advanced : 240 x 160 (19,200 bytes ( 60.0%))
|
||||||
|
; 8. Ancient Land of Y's : 288 x 128 (18,432 bytes ( 57.6%))
|
||||||
|
; 9. Game Boy Color : 160 x 144 (11,520 bytes ( 36.0%))
|
||||||
|
|
||||||
rel
|
rel
|
||||||
|
|
||||||
@ -65,8 +77,12 @@ SHR_SCB equ $E19D00
|
|||||||
jsr MemInit
|
jsr MemInit
|
||||||
jsr GrafInit
|
jsr GrafInit
|
||||||
|
|
||||||
lda BlitBuff+2 ; Fill in this bank
|
]step equ 0
|
||||||
|
lup 13
|
||||||
|
lda BlitBuff+]step+2
|
||||||
jsr BuildBank
|
jsr BuildBank
|
||||||
|
]step equ ]step+4
|
||||||
|
--^
|
||||||
|
|
||||||
; Load a picture and copy it into Bank $E1. Then turn on the screen.
|
; Load a picture and copy it into Bank $E1. Then turn on the screen.
|
||||||
|
|
||||||
@ -216,63 +232,82 @@ stk_save lda #0000 ; load the stack
|
|||||||
jmp EvtLoop
|
jmp EvtLoop
|
||||||
|
|
||||||
HexToChar dfb '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
|
HexToChar dfb '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
|
||||||
DoMessage
|
|
||||||
sep #$20
|
; Convert a byte (Acc) into a string and store at (Y)
|
||||||
ldx #0
|
ByteToString sep #$20
|
||||||
lda BlitBuff+2
|
pha
|
||||||
|
|
||||||
and #$F0
|
and #$F0
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
tax
|
tax
|
||||||
lda HexToChar,x
|
ldal HexToChar,x
|
||||||
sta Hello+1
|
sta: $0000,y
|
||||||
|
|
||||||
lda BlitBuff+2
|
pla
|
||||||
and #$0F
|
and #$0F
|
||||||
tax
|
tax
|
||||||
lda HexToChar,x
|
ldal HexToChar,x
|
||||||
sta Hello+2
|
sta: $0001,y
|
||||||
|
|
||||||
lda BlitBuff+1
|
|
||||||
and #$F0
|
|
||||||
lsr
|
|
||||||
lsr
|
|
||||||
lsr
|
|
||||||
lsr
|
|
||||||
tax
|
|
||||||
lda HexToChar,x
|
|
||||||
sta Hello+4
|
|
||||||
|
|
||||||
lda BlitBuff+1
|
|
||||||
and #$0F
|
|
||||||
tax
|
|
||||||
lda HexToChar,x
|
|
||||||
sta Hello+5
|
|
||||||
|
|
||||||
lda BlitBuff
|
|
||||||
and #$F0
|
|
||||||
lsr
|
|
||||||
lsr
|
|
||||||
lsr
|
|
||||||
lsr
|
|
||||||
tax
|
|
||||||
lda HexToChar,x
|
|
||||||
sta Hello+6
|
|
||||||
|
|
||||||
lda BlitBuff
|
|
||||||
and #$0F
|
|
||||||
tax
|
|
||||||
lda HexToChar,x
|
|
||||||
sta Hello+7
|
|
||||||
|
|
||||||
rep #$20
|
rep #$20
|
||||||
|
rts
|
||||||
|
|
||||||
|
; Pass in Acc = High, X = low
|
||||||
|
Addr3ToString phx
|
||||||
|
jsr ByteToString
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
lda 1,s
|
||||||
|
xba
|
||||||
|
jsr ByteToString
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
pla
|
||||||
|
jsr ByteToString
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
:count = 4
|
||||||
|
:ptr = 6
|
||||||
|
:addr = 10
|
||||||
|
DoMessage stz :addr
|
||||||
|
lda #13
|
||||||
|
sta :count
|
||||||
|
lda #BlitBuff
|
||||||
|
sta :ptr
|
||||||
|
lda #^BlitBuff
|
||||||
|
sta :ptr+2
|
||||||
|
|
||||||
|
:loop lda [:ptr]
|
||||||
|
tax
|
||||||
|
ldy #2
|
||||||
|
lda [:ptr],y
|
||||||
|
|
||||||
|
ldy #Hello+1
|
||||||
|
jsr Addr3ToString
|
||||||
|
|
||||||
lda #Hello
|
lda #Hello
|
||||||
ldx #{60*160+30}
|
ldx :addr
|
||||||
ldy #$7777
|
ldy #$7777
|
||||||
jsr DrawString
|
jsr DrawString
|
||||||
|
|
||||||
|
lda :addr
|
||||||
|
clc
|
||||||
|
adc #160*8
|
||||||
|
sta :addr
|
||||||
|
|
||||||
|
inc :ptr
|
||||||
|
inc :ptr
|
||||||
|
inc :ptr
|
||||||
|
inc :ptr
|
||||||
|
|
||||||
|
dec :count
|
||||||
|
lda :count
|
||||||
|
bne :loop
|
||||||
|
|
||||||
jmp EvtLoop
|
jmp EvtLoop
|
||||||
|
|
||||||
DoLoadPic
|
DoLoadPic
|
||||||
@ -311,7 +346,7 @@ Exit
|
|||||||
bcs Fatal
|
bcs Fatal
|
||||||
Fatal brk $00
|
Fatal brk $00
|
||||||
|
|
||||||
Hello str '00/0000'
|
Hello str '000000'
|
||||||
|
|
||||||
****************************************
|
****************************************
|
||||||
* Fatal Error Handler *
|
* Fatal Error Handler *
|
||||||
@ -591,6 +626,43 @@ qtRec adrl $0000
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user