Commit e951e9a8 authored by Scott Duensing's avatar Scott Duensing

Timer working on IIgs! asmSlam optimized a bit.

parent 4aa716b1
......@@ -16,7 +16,7 @@ iix makelib 31:/out/joey/joeylib +31:/out/joey/jIIgsc.a
iix makelib 31:/out/joey/joeylib +31:/out/joey/joey.a
iix compile test.c keep=31:/out/joey/test
iix -DKeepType=S16 link 31:/out/joey/test 31:/out/joey/joeylib keep=31:/out/joey/test
iix -DKeepType=S16 link +L 31:/out/joey/test 31:/out/joey/joeylib keep=31:/out/joey/test > test.map
iix dumpobj +D 31:/out/joey/test &> test.dis || true
......
......@@ -43,3 +43,5 @@ SDL_MIXER_LIBS = \
LIBS += \
$$SDL_LIBS \
$$SDL_MIXER_LIBS
DISTFILES +=
......@@ -29,10 +29,6 @@ savedDBR data ; Storage for Data Bank Register
ds 2 ; 16 bits
end ; Used by jIIgs.macro
vblDBR data ; Storage for Data Bank Register during VBL Interrupt
ds 2 ; 16 bits
end
ScanTable data
ds 400 ; 400 bytes for scanline offsets
end
......@@ -392,32 +388,6 @@ PBoth sta temp3 ; Store accumulator in temp3
jreturn
end
;----------------------------------------
; Turn SHR Shadowing Off
;----------------------------------------
asmShOff start
jsubroutine
short m
lda $E0C035
ora #$08
sta $E0C035
long m
jreturn
end
;----------------------------------------
; Turn SHR Shadowing On
;----------------------------------------
asmShOn start
jsubroutine
short m
lda $E0C035
and #$F7
sta $E0C035
long m
jreturn
end
;----------------------------------------
; "PEI Slam" shadowed SHR display to the
; actual display. Copies all 200 lines,
......@@ -429,17 +399,23 @@ asmSlam start
jsubroutine
short m ; Turn Shadowing On
lda $E0C035
and #$F7
sta $E0C035
long m
php ; Push Processor Status Register
tdc ; Transfer Direct Register to C Accumulator
sta >DataPtr ; Store Accumulator in DataPtr
lda >$E0C068-1
pha ; Save main/aux bank state
phd ; Save DPage
tsc ; Transfer Stack Pointer to C Accumulator
sta >StackPtr ; Store Accumulator in StackPtr
sei ; Disable interrupts
short m
sta >$00C005 ; Switch to AUX
sta >$00C003
long m
lda #$3000 ; Read/write aux 48k (SHR) via bank 0
sta >$E0C068-1
ldy #$2000 ; Point to start of SHR
......@@ -601,41 +577,39 @@ peiPage tya
brl peiPage
peiInts short m
sta >$00C004 ; Switch to MAIN
sta >$00C002
long m
peiInts lda #0 ; Swap main 48k into bank 0
sta >$E0C068-1
lda >StackPtr ; Load original Stack Pointer into Accumulator
tcs ; Transfer Accumulator to Stack Pointer (Restores original stack)
lda >DataPtr ; Load original Direct Pointer into Accumulator
tcd ; Transfer Accumulator to Direct Pointer (Restores direct page)
pld ; Restore direct page
cli ; Go Interrupts! Go!
sei ; Stop interrupts
short m
sta >$00C005 ; Switch to AUX
sta >$00C003
long m
phd
lda #$3000 ; Read/write aux 48k (SHR) via bank 0
sta >$E0C068-1
brl peiChunk
peiEnd short m
sta >$00C004 ; Switch to MAIN
sta >$00C002
long m
peiEnd lda #0 ; Swap main 48k into bank 0
sta >$E0C068-1
lda >StackPtr
tcs ; Restore stack
lda >DataPtr
tcd ; Restore DP
cli ; Enable Interrupts
pld ; Restore DP
pla
sta >$E0C068-1 ; Restore main/aux bank state
plp ; Restore processor register
short m ; Turn Shadowing Off
lda $E0C035
ora #$08
sta $E0C035
long m
jreturn
StackPtr ds 2 ; Space for SP
DataPtr ds 2 ; Space for DP
end
......@@ -667,11 +641,12 @@ STL sta ScanTable,x ; Store accumulator in ScanTable+x
lda #42 ; Reset timer
sta >VblTime
;ph4 #VblHdr ; Start VBL interrupt task
;ldx #$1203 ;_SetHeartBeat
;jsl $E10000
ph4 #VblHdr ; Start VBL interrupt task
ldx #$1203 ;_SetHeartBeat
jsl $E10000
jreturn
jsl VblTask ; This is a dummy call to be sure there's a reference to VblTask when linking as a library.
end
;----------------------------------------
......@@ -680,9 +655,9 @@ STL sta ScanTable,x ; Store accumulator in ScanTable+x
asmStop start
jsubroutine
;ph4 #VblHdr ; Stop VBL interrupt task
;ldx #$1303 ;_DelHeartBeat
;jsl $E10000
ph4 #VblHdr ; Stop VBL interrupt task
ldx #$1303 ;_DelHeartBeat
jsl $E10000
jreturn
end
......@@ -699,23 +674,11 @@ VblCount dc i2'1' ; How many VBLs between calls (1 only on initial call)
VblTask start
using VblHdr
using VblRate
using vblDBR
long m ; 16 bit Accumulator
phb ; Push Data Bank Register
phb ; Push Data Bank Register
pla ; Pull Accumulator
sta >vblDBR ; Store Accumulator in savedDBR (Data Bank Register)
phk ; Push K (Program Bank Register)
plb ; Pull Data Bank Register
lda >VblRate ; Reset counter
lda >VblRate ; Reset hearbeat counter
sta >VblCount
lda >VblTime ; Increment timer
inc a
sta >VblTime
lda >vblDBR ; Load our saved Data Bank Register
pha ; Push the C Accumulator
plb ; Pull Data Bank Register
plb ; Pull Data Bank Register
short m ; Back to 8 bit Accumulator
rtl
end
......@@ -49,8 +49,6 @@ extern void asmBorder(int c);
extern void asmGrOff(void);
extern void asmGrOn(void);
extern int asmJoy(int which);
extern void asmShOff(void);
extern void asmShOn(void);
extern void asmSlam(void);
extern void asmStart(int myID, int hertzBy10);
extern void asmStop(void);
......@@ -105,9 +103,7 @@ void _jlDebugBorder(jlBorderColorsE color) {
void jlDisplayPresent(void) {
asmShOn();
asmSlam();
asmShOff();
asmBorder(_jlBorderColor);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment