1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-04-05 03:37:43 +00:00

Going for all optimizations

This commit is contained in:
David Schmenk 2025-03-25 17:35:27 -07:00
parent 0fe84a9bdb
commit 4157f0235e
2 changed files with 372 additions and 192 deletions

View File

@ -485,7 +485,7 @@ def idleSpin#0
// Rotate Enterprise
//
dhgrSurfMem(OP_SRC, VIEW_HEIGHT, viewbuf, viewspan)
dcgrColor(CLR_BLACK)
dcgrColor(CLR_DRKBLUE)
dhgrClearBl7(0, 0, VIEW_WIDTH7, VIEW_HEIGHT)
dcgrColor(CLR_GREEN)
for oi = (xpos/4)&31 to VIEW_WIDTH-1 step 32

View File

@ -170,38 +170,102 @@ byte auxclrl, auxclrh, memclrl, memclrh
//
// Divide 7 combined with Modulo 7
//
byte divmod7[] = 0+0, 0+1, 0+2, 0+3, 0+4, 0+5, 0+6
byte = 8+0, 8+1, 8+2, 8+3, 8+4, 8+5, 8+6
byte = 16+0, 16+1, 16+2, 16+3, 16+4, 16+5, 16+6
byte = 24+0, 24+1, 24+2, 24+3, 24+4, 24+5, 24+6
byte = 32+0, 32+1, 32+2, 32+3, 32+4, 32+5, 32+6
byte = 40+0, 40+1, 40+2, 40+3, 40+4, 40+5, 40+6
byte = 48+0, 48+1, 48+2, 48+3, 48+4, 48+5, 48+6
byte = 56+0, 56+1, 56+2, 56+3, 56+4, 56+5, 56+6
byte = 64+0, 64+1, 64+2, 64+3, 64+4, 64+5, 64+6
byte = 72+0, 72+1, 72+2, 72+3, 72+4, 72+5, 72+6
byte = 80+0, 80+1, 80+2, 80+3, 80+4, 80+5, 80+6
byte = 88+0, 88+1, 88+2, 88+3, 88+4, 88+5, 88+6
byte = 96+0, 96+1, 96+2, 96+3, 96+4, 96+5, 96+6
byte = 104+0, 104+1, 104+2, 104+3, 104+4, 104+5, 104+6
byte = 112+0, 112+1, 112+2, 112+3, 112+4, 112+5, 112+6
byte = 120+0, 120+1, 120+2, 120+3, 120+4, 120+5, 120+6
byte = 128+0, 128+1, 128+2, 128+3, 128+4, 128+5, 128+6
byte = 136+0, 136+1, 136+2, 136+3, 136+4, 136+5, 136+6
byte = 144+0, 144+1, 144+2, 144+3, 144+4, 144+5, 144+6
byte = 152+0, 152+1, 152+2, 152+3, 152+4, 152+5, 152+6
byte = 160+0, 160+1, 160+2, 160+3, 160+4, 160+5, 160+6
byte = 168+0, 168+1, 168+2, 168+3, 168+4, 168+5, 168+6
byte = 176+0, 176+1, 176+2, 176+3, 176+4, 176+5, 176+6
byte = 184+0, 184+1, 184+2, 184+3, 184+4, 184+5, 184+6
byte = 192+0, 192+1, 192+2, 192+3, 192+4, 192+5, 192+6
byte = 200+0, 200+1, 200+2, 200+3, 200+4, 200+5, 200+6
byte = 208+0, 208+1, 208+2, 208+3, 208+4, 208+5, 208+6
byte = 216+0, 216+1, 216+2, 216+3, 216+4, 216+5, 216+6
byte = 224+0, 224+1, 224+2, 224+3, 224+4, 224+5, 224+6
byte = 232+0, 232+1, 232+2, 232+3, 232+4, 232+5, 232+6
byte = 240+0, 240+1, 240+2, 240+3, 240+4, 240+5, 240+6
byte = 248+0, 248+1, 248+2, 248+3, 248+4, 248+5, 248+6
//byte divmod7[] = 0+0, 0+1, 0+2, 0+3, 0+4, 0+5, 0+6
//byte = 8+0, 8+1, 8+2, 8+3, 8+4, 8+5, 8+6
//byte = 16+0, 16+1, 16+2, 16+3, 16+4, 16+5, 16+6
//byte = 24+0, 24+1, 24+2, 24+3, 24+4, 24+5, 24+6
//byte = 32+0, 32+1, 32+2, 32+3, 32+4, 32+5, 32+6
//byte = 40+0, 40+1, 40+2, 40+3, 40+4, 40+5, 40+6
//byte = 48+0, 48+1, 48+2, 48+3, 48+4, 48+5, 48+6
//byte = 56+0, 56+1, 56+2, 56+3, 56+4, 56+5, 56+6
//byte = 64+0, 64+1, 64+2, 64+3, 64+4, 64+5, 64+6
//byte = 72+0, 72+1, 72+2, 72+3, 72+4, 72+5, 72+6
//byte = 80+0, 80+1, 80+2, 80+3, 80+4, 80+5, 80+6
//byte = 88+0, 88+1, 88+2, 88+3, 88+4, 88+5, 88+6
//byte = 96+0, 96+1, 96+2, 96+3, 96+4, 96+5, 96+6
//byte = 104+0, 104+1, 104+2, 104+3, 104+4, 104+5, 104+6
//byte = 112+0, 112+1, 112+2, 112+3, 112+4, 112+5, 112+6
//byte = 120+0, 120+1, 120+2, 120+3, 120+4, 120+5, 120+6
//byte = 128+0, 128+1, 128+2, 128+3, 128+4, 128+5, 128+6
//byte = 136+0, 136+1, 136+2, 136+3, 136+4, 136+5, 136+6
//byte = 144+0, 144+1, 144+2, 144+3, 144+4, 144+5, 144+6
//byte = 152+0, 152+1, 152+2, 152+3, 152+4, 152+5, 152+6
//byte = 160+0, 160+1, 160+2, 160+3, 160+4, 160+5, 160+6
//byte = 168+0, 168+1, 168+2, 168+3, 168+4, 168+5, 168+6
//byte = 176+0, 176+1, 176+2, 176+3, 176+4, 176+5, 176+6
//byte = 184+0, 184+1, 184+2, 184+3, 184+4, 184+5, 184+6
//byte = 192+0, 192+1, 192+2, 192+3, 192+4, 192+5, 192+6
//byte = 200+0, 200+1, 200+2, 200+3, 200+4, 200+5, 200+6
//byte = 208+0, 208+1, 208+2, 208+3, 208+4, 208+5, 208+6
//byte = 216+0, 216+1, 216+2, 216+3, 216+4, 216+5, 216+6
//byte = 224+0, 224+1, 224+2, 224+3, 224+4, 224+5, 224+6
//byte = 232+0, 232+1, 232+2, 232+3, 232+4, 232+5, 232+6
//byte = 240+0, 240+1, 240+2, 240+3, 240+4, 240+5, 240+6
//byte = 248+0, 248+1, 248+2, 248+3, 248+4, 248+5, 248+6
byte div7[] = 0>>2, 0>>2, 0>>2, 0>>2, 0>>2, 0>>2, 0>>2
byte = 8>>2, 8>>2, 8>>2, 8>>2, 8>>2, 8>>2, 8>>2
byte = 16>>2, 16>>2, 16>>2, 16>>2, 16>>2, 16>>2, 16>>2
byte = 24>>2, 24>>2, 24>>2, 24>>2, 24>>2, 24>>2, 24>>2
byte = 32>>2, 32>>2, 32>>2, 32>>2, 32>>2, 32>>2, 32>>2
byte = 40>>2, 40>>2, 40>>2, 40>>2, 40>>2, 40>>2, 40>>2
byte = 48>>2, 48>>2, 48>>2, 48>>2, 48>>2, 48>>2, 48>>2
byte = 56>>2, 56>>2, 56>>2, 56>>2, 56>>2, 56>>2, 56>>2
byte = 64>>2, 64>>2, 64>>2, 64>>2, 64>>2, 64>>2, 64>>2
byte = 72>>2, 72>>2, 72>>2, 72>>2, 72>>2, 72>>2, 72>>2
byte = 80>>2, 80>>2, 80>>2, 80>>2, 80>>2, 80>>2, 80>>2
byte = 88>>2, 88>>2, 88>>2, 88>>2, 88>>2, 88>>2, 88>>2
byte = 96>>2, 96>>2, 96>>2, 96>>2, 96>>2, 96>>2, 96>>2
byte = 104>>2, 104>>2, 104>>2, 104>>2, 104>>2, 104>>2, 104>>2
byte = 112>>2, 112>>2, 112>>2, 112>>2, 112>>2, 112>>2, 112>>2
byte = 120>>2, 120>>2, 120>>2, 120>>2, 120>>2, 120>>2, 120>>2
byte = 128>>2, 128>>2, 128>>2, 128>>2, 128>>2, 128>>2, 128>>2
byte = 136>>2, 136>>2, 136>>2, 136>>2, 136>>2, 136>>2, 136>>2
byte = 144>>2, 144>>2, 144>>2, 144>>2, 144>>2, 144>>2, 144>>2
byte = 152>>2, 152>>2, 152>>2, 152>>2, 152>>2, 152>>2, 152>>2
byte = 160>>2, 160>>2, 160>>2, 160>>2, 160>>2, 160>>2, 160>>2
byte = 168>>2, 168>>2, 168>>2, 168>>2, 168>>2, 168>>2, 168>>2
byte = 176>>2, 176>>2, 176>>2, 176>>2, 176>>2, 176>>2, 176>>2
byte = 184>>2, 184>>2, 184>>2, 184>>2, 184>>2, 184>>2, 184>>2
byte = 192>>2, 192>>2, 192>>2, 192>>2, 192>>2, 192>>2, 192>>2
byte = 200>>2, 200>>2, 200>>2, 200>>2, 200>>2, 200>>2, 200>>2
byte = 208>>2, 208>>2, 208>>2, 208>>2, 208>>2, 208>>2, 208>>2
byte = 216>>2, 216>>2, 216>>2, 216>>2, 216>>2, 216>>2, 216>>2
byte = 224>>2, 224>>2, 224>>2, 224>>2, 224>>2, 224>>2, 224>>2
byte = 232>>2, 232>>2, 232>>2, 232>>2, 232>>2, 232>>2, 232>>2
byte = 240>>2, 240>>2, 240>>2, 240>>2, 240>>2, 240>>2, 240>>2
byte = 248>>2, 248>>2, 248>>2, 248>>2, 248>>2, 248>>2, 248>>2
byte mod7[] = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
byte = 0, 1, 2, 3, 4, 5, 6
//
// Color -> DHGR pixel
//
@ -401,15 +465,18 @@ end
// Plot OP_SRC
//
asm _dcgrPlotScrB
LDA $3000,Y ; DIVMOD7
TAX
AND #$F8
LSR
LSR
TAY ; DIV7
TXA
AND #$07
TAX ; MOD7
LDX $3000,Y ; MOD7
LDA $4000,Y ; DIV7
TAY
; LDA $3000,Y ; DIVMOD7
; TAX
; AND #$F8
; LSR
; LSR
; TAY ; DIV7
; TXA
; AND #$07
; TAX ; MOD7
end
asm _dcgrPlotScrC
LDA $4000,X ; AUXCLRMSK
@ -423,7 +490,8 @@ asm _dcgrPlotScrD
AND $4000,X ; AUXCLRMSK
EOR (DST),Y
STA (DST),Y
BCC ++ ; CARRY WILL BE CLEAR FROM ABOVE
BNE ++
BEQ ++
+ INY
end
asm _dcgrPlotScrE
@ -463,15 +531,18 @@ end
// Plot OP_XOR,OP_AND,OP_OR
//
asm _dcgrOpPlotScrB
LDA $3000,Y ; DIVMOD7
TAX
AND #$F8
LSR
LSR
TAY ; DIV7
TXA
AND #$07
TAX ; MOD7
LDX $3000,Y ; MOD7
LDA $4000,Y ; DIV7
TAY
; LDA $3000,Y ; DIVMOD7
; TAX
; AND #$F8
; LSR
; LSR
; TAY ; DIV7
; TXA
; AND #$07
; TAX ; MOD7
end
asm _dcgrOpPlotScrC
LDA $4000,X ; AUXCLRMSK
@ -483,7 +554,8 @@ asm _dcgrOpPlotScrD
AND $5000 ; AUXCLRL
EOR (DST),Y
STA (DST),Y
BCC ++ ; CARRY WILL BE CLEAR FROM ABOVE
BNE ++
BEQ ++
+ INY
end
asm _dcgrOpPlotScrE
@ -863,15 +935,18 @@ end
asm _dcgrPlotMemB
LSR
STA TMPH
LDA $3000,Y ; DIVMOD7
TAX
AND #$F8
LSR
LSR
TAY ; DIV7
TXA
AND #$07
TAX ; MOD7
LDX $3000,Y ; MOD7
LDA $4000,Y ; DIV7
TAY
; LDA $3000,Y ; DIVMOD7
; TAX
; AND #$F8
; LSR
; LSR
; TAY ; DIV7
; TXA
; AND #$07
; TAX ; MOD7
end
//
// Plot OP_SRC
@ -887,7 +962,8 @@ asm _dcgrPlotMemD
AND $4000,X ; AUXCLRMSK
EOR (DST),Y
STA (DST),Y
BCC ++ ; CARRY WILL BE CLEAR FROM ABOVE
BNE ++
BEQ ++
+ INY
end
asm _dcgrPlotMemE
@ -932,15 +1008,18 @@ end
asm _dcgrOpPlotMemB
LSR
STA TMPH
LDA $3000,Y ; DIVMOD7
TAX
AND #$F8
LSR
LSR
TAY ; DIV7
TXA
AND #$07
TAX ; MOD7
LDX $3000,Y ; MOD7
LDA $4000,Y ; DIV7
TAY
; LDA $3000,Y ; DIVMOD7
; TAX
; AND #$F8
; LSR
; LSR
; TAY ; DIV7
; TXA
; AND #$07
; TAX ; MOD7
end
asm _dcgrOpPlotMemC
LDA $4000,X ; AUXCLRMSK
@ -1401,8 +1480,6 @@ asm dhgrScrBl7Mem(x7, y, w7, h, memptr, memspan)#0
LDA ESTKH-5,X
SBC #$00
STA DSTH
;LSR ESTKH-6,X ; SPAN / 2
;ROR ESTKL-6,X
LSR ESTKL-6,X ; SPAN / 2
ASL ESTKL-1,X ; X7 COORD * 2
ASL ESTKL-3,X ; WIDTH7 * 2
@ -1413,9 +1490,8 @@ YS7M LDY ESTKL-2,X ; Y COORD
end
asm _dcgrScrBl7MemA
ADC $2000,Y ; HGRSCANL
STA SRCL
LDA #$00
ADC $3000,Y ; HGRSCANH
STA SRCL ; THIS WON'T CARRY OUT
LDA $3000,Y ; HGRSCANH
STA SRCH
LDA SRCL
BNE +
@ -1489,19 +1565,31 @@ asm _clipYMemBl7Scr
STA SRCH
DEY
BNE -
+ ;LSR ESTKH-6,X ; SPAN / 2
;ROR ESTKL-6,X
LSR ESTKL-6,X
+ LSR ESTKL-6,X
ASL ESTKL-1,X ; X7 COORD * 2
ASL ESTKL-3,X ; WIDTH7 * 2
DEC ESTKL-3,X ; WIDTH7 * 2 - 1
end
asm _jmpOpMemBl7Scr
JMP $A000
YM7S INC ESTKL-2,X ; Y COORD++
JSR $A000
end
asm _dcgrMemBl7ScrA
LDY ESTKL-2,X ; Y COORD
YM7S__ PLA ; SELF MODIFYING CODE!
STA TMPL
PLA
STA TMPH
LDA ESTKL-3,X ; WIDTH7*2-1
LDY #YM7S_A-YM7S__+2
STA (TMP),Y
LDY #YM7S_C-YM7S__+2
STA (TMP),Y
LDA ESTKL-6,X ; HALF SPAN
LDY #YM7S_B-YM7S__+2
STA (TMP),Y
LDY #YM7S_D-YM7S__+2
STA (TMP),Y
YM7S LDY ESTKL-2,X ; Y COORD
INC ESTKL-2,X ; Y COORD++
LDA ESTKL-1,X ; X7 COORD
end
asm _dcgrMemBl7ScrB
@ -1510,7 +1598,7 @@ asm _dcgrMemBl7ScrB
LDA $2000,Y ; HGRSCANH
STA DSTH
STA $C055 ; PAGE1X
LDY ESTKL-3,X ; WIDTH7*2-1
YM7S_A LDY #$01 ; ESTKL-3,X WIDTH7*2-1
- LDA (SRC),Y
STA (DST),Y
DEY
@ -1519,12 +1607,12 @@ asm _dcgrMemBl7ScrB
DEY
BPL -
;CLC
LDA ESTKL-6,X ; HALF SPAN
YM7S_B LDA #$01 ; ESTKL-6,X HALF SPAN
ADC SRCL
STA SRCL
BCS YM7SIH
-- STA $C054 ; PAGE1M
LDY ESTKL-3,X ; WIDTH7*2-1
YM7S_C LDY #$02 ; ESTKL-3,X WIDTH7*2-1
- LDA (SRC),Y
STA (DST),Y
DEY
@ -1535,7 +1623,7 @@ asm _dcgrMemBl7ScrB
DEC ESTKL-4,X ; HEIGHT
BEQ RETM7S
;CLC
LDA ESTKL-6,X ; HALF SPAN
YM7S_D LDA #$01 ; ESTKL-6,X HALF SPAN
ADC SRCL
STA SRCL
BCC YM7S
@ -1546,11 +1634,24 @@ YM7SIH INC SRCH
CLC
BCC --
RETM7S RTS
YOM7S INC ESTKL-2,X ; Y COORD++
end
asm _dcgrOpMemBl7ScrA
LDY ESTKL-2,X ; Y COORD
PLA ; SELF MODIFYING CODE!
STA TMPL
PLA
STA TMPH
LDA ESTKL-3,X ; WIDTH7*2-1
LDY #YOM7S_A-YM7S__+2
STA (TMP),Y
LDY #YOM7S_C-YM7S__+2
STA (TMP),Y
LDA ESTKL-6,X ; HALF SPAN
LDY #YOM7S_B-YM7S__+2
STA (TMP),Y
LDY #YOM7S_D-YM7S__+2
STA (TMP),Y
YOM7S LDY ESTKL-2,X ; Y COORD
INC ESTKL-2,X ; Y COORD++
LDA ESTKL-1,X ; X7 COORD
;CLC
end
@ -1560,7 +1661,7 @@ asm _dcgrOpMemBl7ScrB
LDA $2000,Y ; HGRSCANH
STA DSTH
STA $C055 ; PAGE1X
LDY ESTKL-3,X ; WIDTH7*2-1
YOM7S_A LDY #$01 ; ESTKL-3,X WIDTH7*2-1
- LDA (SRC),Y
end
asm _dcgrOpMemBl7ScrC
@ -1569,12 +1670,12 @@ asm _dcgrOpMemBl7ScrC
DEY
BPL -
;CLC
LDA ESTKL-6,X ; HALF SPAN
YOM7S_B LDA #$01 ; ESTKL-6,X HALF SPAN
ADC SRCL
STA SRCL
BCS YOM7SIH
-- STA $C054 ; PAGE1M
LDY ESTKL-3,X ; WIDTH7*2-1
YOM7S_C LDY #$01 ; ESTKL-3,X ; WIDTH7*2-1
- LDA (SRC),Y
end
asm _dcgrOpMemBl7ScrD
@ -1585,7 +1686,7 @@ asm _dcgrOpMemBl7ScrD
DEC ESTKL-4,X ; HEIGHT
BEQ RETOM7S
;CLC
LDA ESTKL-6,X ; HALF SPAN
YOM7S_D LDA #$01 ; ESTKL-6,X HALF SPAN
ADC SRCL
STA SRCL
BCC YOM7S
@ -1663,76 +1764,103 @@ asm _clipYMemBl7Mem
STA DSTH
DEY
BNE -
+ ;LSR ESTKH-6,X ; SRC SPAN / 2
;ROR ESTKL-6,X
LSR ESTKL-6,X
;LSR ESTKH-10,X ; DST SPAN / 2
;ROR ESTKL-10,X
;LSR ESTKL-10,X
LDA SRCL
BNE +
DEC SRCH
+ DEC SRCL
LDA DSTL
BNE +
DEC DSTH
+ DEC DSTL
ASL ESTKL-3,X ; SRC WIDTH7 * 2
+ LSR ESTKL-6,X
ASL ESTKL-3,X ; SRC WIDTH7 * 2
DEC ESTKL-3,X ; SRC WIDTH7 * 2 - 1
end
asm _jmpOpMemBl7Mem
JMP $F000
JSR $F000
end
asm _dcgrMemBl7MemB
YM7M LDY ESTKL-3,X ; SRC WIDTH7*2
YM7M__ PLA
STA TMPL
PLA
STA TMPH
LDA ESTKL-3,X ; SRC WIDTH7*2-1
LDY #YM7M-YM7M__+2
STA (TMP),Y
LDY #YM7M_C-YM7M__+2
STA (TMP),Y
LDA ESTKL-6,X ; HALF SRC SPAN
LDY #YM7M_A-YM7M__+2
STA (TMP),Y
LDY #YM7M_D-YM7M__+2
STA (TMP),Y
LDA ESTKH-10,X ; HALF DST SPAN
LDY #YM7M_B-YM7M__+2
STA (TMP),Y
LDY #YM7M_E-YM7M__+2
STA (TMP),Y
YM7M LDY #$01 ; ESTKL-3,X SRC WIDTH7*2-1
- LDA (SRC),Y
STA (DST),Y
DEY
LDA (SRC),Y
STA (DST),Y
DEY
BNE -
LDA ESTKL-6,X
BPL -
YM7M_A LDA #$01 ; ESTKL-6,X HALF SRC SPAN
;CLC
ADC SRCL
STA SRCL
BCC +
BCC YM7M_B
INC SRCH
CLC
+ LDA ESTKH-10,X ; ESTKL-10,X HALF DST SPAN
YM7M_B LDA #$01 ; ESTKH-10,X HALF DST SPAN
;CLC
ADC DSTL
STA DSTL
BCC +
BCC YM7M_C
INC DSTH
CLC
+ LDY ESTKL-3,X ; SRC WIDTH7*2
YM7M_C LDY #$01 ; ESTKL-3,X SRC WIDTH7*2-1
- LDA (SRC),Y
STA (DST),Y
DEY
LDA (SRC),Y
STA (DST),Y
DEY
BNE -
LDA ESTKL-6,X
BPL -
DEC ESTKL-4,X ; SRC HEIGHT
BEQ RETM7M
YM7M_D LDA #$01 ; ESTKL-6,X HALF SRC SPAN
;CLC
ADC SRCL
STA SRCL
BCC +
BCC YM7M_E
INC SRCH
CLC
+ LDA ESTKH-10,X ; ESTKL-10,X HALF DST SPAN
YM7M_E LDA #$01 ; ESTKH-10,X HALF DST SPAN
;CLC
ADC DSTL
STA DSTL
BCC +
BCC YM7M
INC DSTH
CLC
+ DEC ESTKL-4,X ; SRC HEIGHT
BNE YM7M
BCC YM7M
RETM7M RTS
end
asm _dcgrOpMemBl7MemB
YOM7M LDY ESTKL-3,X ; SRC WIDTH7*2
PLA ; SELF MODIFYING CODE!
STA TMPL
PLA
STA TMPH
LDA ESTKL-3,X ; SRC WIDTH7*2-1
LDY #YOM7M-YM7M__+2
STA (TMP),Y
LDY #YOM7M_C-YM7M__+2
STA (TMP),Y
LDA ESTKL-6,X ; HALF SRC SPAN
LDY #YOM7M_A-YM7M__+2
STA (TMP),Y
LDY #YOM7M_D-YM7M__+2
STA (TMP),Y
LDA ESTKH-10,X ; HALF DST SPAN
LDY #YOM7M_B-YM7M__+2
STA (TMP),Y
LDY #YOM7M_E-YM7M__+2
STA (TMP),Y
YOM7M LDY #$01 ; ESTKL-3,X ; SRC WIDTH7*2-1
- LDA (SRC),Y
end
asm _dcgrOpMemBl7MemC
@ -1743,22 +1871,22 @@ asm _dcgrOpMemBl7MemC
EOR (DST),Y
STA (DST),Y
DEY
BNE -
LDA ESTKL-6,X ; HALF SRC SPAN
BPL -
YOM7M_A LDA #$01 ; ESTKL-6,X HALF SRC SPAN
;CLC
ADC SRCL
STA SRCL
BCC +
BCC YOM7M_B
INC SRCH
CLC
+ LDA ESTKH-10,X ; ESTKL-10,X HALF DST SPAN
YOM7M_B LDA #$01 ; ESTKH-10,X HALF DST SPAN
;CLC
ADC DSTL
STA DSTL
BCC +
BCC YOM7M_C
INC DSTH
CLC
+ LDY ESTKL-3,X ; SRC WIDTH7*2
YOM7M_C LDY #$01 ; ESTKL-3,X SRC WIDTH7*2-1
- LDA (SRC),Y
end
asm _dcgrOpMemBl7MemD
@ -1769,24 +1897,25 @@ asm _dcgrOpMemBl7MemD
EOR (DST),Y
STA (DST),Y
DEY
BNE -
LDA ESTKL-6,X ; HALF SRC SPAN
BPL -
YOM7M_D LDA #$01 ; ESTKL-6,X HALF SRC SPAN
;CLC
ADC SRCL
STA SRCL
BCC +
INC SRCH
CLC
+ LDA ESTKH-10,X ; ESTKL-10,X HALF DST SPAN
+ DEC ESTKL-4,X ; SRC HEIGHT
BEQ RETOM7M
YOM7M_E LDA #$01 ; ESTKH-10,X HALF DST SPAN
;CLC
ADC DSTL
STA DSTL
BCC +
BCC YOM7M
INC DSTH
CLC
+ DEC ESTKL-4,X ; SRC HEIGHT
BNE YOM7M
RTS
BCC YOM7M
RETOM7M RTS
end
//
// Clear Screen/Memory Block7
@ -1809,39 +1938,57 @@ asm _clipYClearBl7Scr
ASL ESTKL-3,X ; WIDTH7 * 2
DEC ESTKL-3,X ; WIDTH7 * 2 - 1
ASL ESTKL-1,X ; X7 COORD * 2
end
asm _dcgrClearBl7ScrA
YFILS__ LDA #$00
STA TMPL
LDA #$00
STA TMPH
LDA $3002 ; AUXCLRH
LDY #YFILS_B-YFILS__+1
STA (TMP),Y
LDA $3003 ; MEMCLRH
LDY #YFILS_E-YFILS__+1
STA (TMP),Y
LDA $3000 ; AUXCLRL
LDY #YFILS_C-YFILS__+1
STA (TMP),Y
LDA $3001 ; MEMCLRL
LDY #YFILS_F-YFILS__+1
STA (TMP),Y
LDA ESTKL-3,X ; WIDTH7*2-1
LDY #YFILS_A-YFILS__+1
STA (TMP),Y
LDY #YFILS_D-YFILS__+1
STA (TMP),Y
YFILS LDY ESTKL-2,X ; Y COORD
INC ESTKL-2,X ; Y COORD++
LDA ESTKL-1,X ; X7 COORD
;CLC
end
asm _dcgrClearBl7ScrA
asm _dcgrClearBl7ScrB
ADC $1000,Y ; HGRSCANL
STA DSTL
LDA #$00
ADC $2000,Y ; HGRSCANH
LDA $2000,Y ; HGRSCANH
STA DSTH
STA $C055 ; PAGE1X
LDY ESTKL-3,X ; WIDTH7*2-1
end
asm _dcgrClearBl7ScrB
- LDA $3002 ; AUXCLRH
YFILS_A LDY #$01 ; ESTKL-3,X WIDTH7*2-1
YFILS_B LDA #$00 ; AUXCLRH
STA (DST),Y
DEY
LDA $3000 ; AUXCLRL
YFILS_C LDA #$00 ; AUXCLRL
STA (DST),Y
DEY
BPL -
BPL YFILS_B
STA $C054 ; PAGE1M
LDY ESTKL-3,X ; WIDTH7*2-1
end
asm _dcgrClearBl7ScrC
- LDA $3003 ; MEMCLRH
YFILS_D LDY #$01 ; ESTKL-3,X WIDTH7*2-1
YFILS_E LDA #$00 ; MEMCLRH
STA (DST),Y
DEY
LDA $3001 ; MEMCLRL
YFILS_F LDA #$00 ; MEMCLRL
STA (DST),Y
DEY
BPL -
BPL YFILS_E
DEC ESTKL-4,X ; HEIGHT
BNE YFILS
RETFILS RTS
@ -1884,36 +2031,61 @@ asm dhgrClearBl7Mem(x7, y, w7, h, memptr, memspan)#0
LDA #$00 ; PLA
ADC DSTH
STA SRCH
BNE ++ ; BRA
YFILM LDA ESTKL-6,X ; HALF SPAN
ADC DSTL
STA DSTL
BCC +
INC DSTH
CLC
+ LDA ESTKL-6,X ; SPAN
ADC SRCL
STA SRCL
BCC ++
INC SRCH
CLC
++ LDY ESTKL-3,X ; WIDTH7
end
asm _dcgrClearBl7MemB
- LDA $3002 ; AUXCLRH
STA (DST),Y
YFILM__ LDA #$00 ; SELF MODIFYING CODE!
STA TMPL
LDA #$00
STA TMPH
LDA $3002 ; AUXCLRH
LDY #YFILM_A-YFILM__+1
STA (TMP),Y
LDA $3003 ; MEMCLRH
STA (SRC),Y
DEY
LDY #YFILM_B-YFILM__+1
STA (TMP),Y
LDA $3000 ; AUXCLRL
STA (DST),Y
LDY #YFILM_C-YFILM__+1
STA (TMP),Y
LDA $3001 ; MEMCLRL
LDY #YFILM_D-YFILM__+1
STA (TMP),Y
LDA ESTKL-3,X ; WIDTH7
LDY #YFILM-YFILM__+1
STA (TMP),Y
LDA ESTKL-6,X ; SPAN
LDY #YFILM_E-YFILM__+1
STA (TMP),Y
LDY #YFILM_F-YFILM__+1
STA (TMP),Y
YFILM LDY #$02 ; ESTKL-3,X ; WIDTH7
YFILM_A LDA #$01 ; AUXCLRH
STA (DST),Y
YFILM_B LDA #$02 ; MEMCLRH
STA (SRC),Y
DEY
BNE -
YFILM_C LDA #$03 ; AUXCLRL
STA (DST),Y
YFILM_D LDA #$04 ; MEMCLRL
STA (SRC),Y
DEY
BNE YFILM_A
DEC ESTKL-4,X ; HEIGHT
BNE YFILM
RTS
BEQ RETYFM
YFILM_E LDA #$01 ; ESTKL-6,X SPAN
ADC DSTL
STA DSTL
BCS +
YFILM_F LDA #$01 ; ESTKL-6,X SPAN
ADC SRCL
STA SRCL
BCC YFILM
INC SRCH
CLC
BCC YFILM
+ INC DSTH
CLC
BCC YFILM_F
RETYFM RTS
end
//
// Tile -> Screen Transfer
@ -2305,13 +2477,13 @@ export def dcgrGetPixel(x, y)#1
word[2] pix7
word amask, mmask
x7 = divmod7[x] >> 3
x7 = div7[x] >> 1 // divmod7[x] >> 3
if dhgrSurface // Memory
dhgrMemBl7Mem(x7, y, surfWidth, surfHeight, surfPtr, surfSpan, 1, 1, @pix7)
else // Screen
dhgrScrBl7Mem(x7, y, 1, 1, @pix7, 4)
fin
m7 = divmod7[x] & $07
m7 = mod7[x] // divmod7[x] & $07
amask = auxclrmsk[m7]
if amask & $80; amask = (amask & $7F) << 8; fin
pix7[0] = amask & pix7[0]
@ -2379,7 +2551,8 @@ _dcgrColorA:22 = @memclrh
//
_dcgrPlotScrA:1 = @hgrscanl
_dcgrPlotScrA:6 = @hgrscanh
_dcgrPlotScrB:1 = @divmod7
_dcgrPlotScrB:1 = @mod7//@divmod7
_dcgrPlotScrB:4 = @div7
_dcgrPlotScrC:1 = @auxclrmsk
_dcgrPlotScrD:1 = @auxclrl
_dcgrPlotScrD:6 = @auxclrmsk
@ -2390,7 +2563,8 @@ _dcgrPlotScrG:1 = @memclrl
_dcgrPlotScrG:6 = @memclrmsk
_dcgrPlotScrH:1 = @memclrh
_dcgrPlotScrH:6 = @memclrmsk
_dcgrOpPlotScrB:1 = @divmod7
_dcgrOpPlotScrB:1 = @mod7 // @divmod7
_dcgrOpPlotScrB:4 = @div7
_dcgrOpPlotScrC:1 = @auxclrmsk
_dcgrOpPlotScrD:1 = @auxclrl
_dcgrOpPlotScrE:1 = @auxclrh
@ -2420,16 +2594,19 @@ _dcgrRlemapScrD:1 = @_dcgrColorA
_dcgrRlemapScrE:1 = @_dcgrPlotScrB
_clipXClearBl7Scr:1 = @_clipX
_clipYClearBl7Scr:1 = @_clipY
_dcgrClearBl7ScrA:1 = @hgrscanl
_dcgrClearBl7ScrA:8 = @hgrscanh
_dcgrClearBl7ScrB:1 = @auxclrh
_dcgrClearBl7ScrB:7 = @auxclrl
_dcgrClearBl7ScrC:1 = @memclrh
_dcgrClearBl7ScrC:7 = @memclrl
_dcgrClearBl7ScrA.1 = @_dcgrClearBl7ScrA
_dcgrClearBl7ScrA.5 = @_dcgrClearBl7ScrA >> 8
_dcgrClearBl7ScrA:9 = @auxclrh
_dcgrClearBl7ScrA:16 = @memclrh
_dcgrClearBl7ScrA:23 = @auxclrl
_dcgrClearBl7ScrA:30 = @memclrl
_dcgrClearBl7ScrB:1 = @hgrscanl
_dcgrClearBl7ScrB:6 = @hgrscanh
//
// Memory function fixups
//
_dcgrPlotMemB:4 = @divmod7
_dcgrPlotMemB:4 = @mod7 //@divmod7
_dcgrPlotMemB:7 = @div7
_dcgrPlotMemC:1 = @auxclrmsk
_dcgrPlotMemD:1 = @auxclrl
_dcgrPlotMemD:6 = @auxclrmsk
@ -2440,7 +2617,8 @@ _dcgrPlotMemG:1 = @memclrl
_dcgrPlotMemG:6 = @memclrmsk
_dcgrPlotMemH:1 = @memclrh
_dcgrPlotMemH:6 = @memclrmsk
_dcgrOpPlotMemB:4 = @divmod7
_dcgrOpPlotMemB:4 = @mod7 //@divmod7
_dcgrOpPlotMemB:7 = @div7
_dcgrOpPlotMemC:1 = @auxclrmsk
_dcgrOpPlotMemD:1 = @auxclrl
_dcgrOpPlotMemE:1 = @auxclrh
@ -2458,15 +2636,17 @@ _dcgrRlemapMemB:1 = @_dcgrColorA
_dcgrRlemapMemC:1 = @_dcgrPlotMemB
_dcgrRlemapMemD:1 = @_dcgrColorA
_dcgrRlemapMemE:1 = @_dcgrPlotMemB
_dcgrClearBl7MemB:1 = @auxclrh
_dcgrClearBl7MemB:6 = @memclrh
_dcgrClearBl7MemB:12 = @auxclrl
_dcgrClearBl7MemB:17 = @memclrl
_dcgrClearBl7MemB.1 = @_dcgrClearBl7MemB
_dcgrClearBl7MemB.5 = @_dcgrClearBl7MemB >> 8
_dcgrClearBl7MemB:9 = @auxclrh
_dcgrClearBl7MemB:16 = @memclrh
_dcgrClearBl7MemB:23 = @auxclrl
_dcgrClearBl7MemB:30 = @memclrl
//
// Memory <-> Screen Block Transfer fixups
//
_dcgrScrBl7MemA:1 = @hgrscanl
_dcgrScrBl7MemA:8 = @hgrscanh
_dcgrScrBl7MemA:6 = @hgrscanh
_clipXMemBl7Src:1 = @_clipX
_clipYMemBl7Scr:1 = @_clipY
_dcgrMemBl7ScrB:1 = @hgrscanl