mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-10-03 21:55:17 +00:00
minor size optimisations
note that fontengine.s!Wp_CFnt has a bad compare
This commit is contained in:
parent
294fe817e9
commit
d8e235d753
@ -84,21 +84,19 @@ relocate:
|
|||||||
bit setLcRW+lcBank1 ; only copy bank 1, because bank 2 is PLASMA runtime
|
bit setLcRW+lcBank1 ; only copy bank 1, because bank 2 is PLASMA runtime
|
||||||
bit setLcRW+lcBank1 ; write to it
|
bit setLcRW+lcBank1 ; write to it
|
||||||
; verify that aux mem exists
|
; verify that aux mem exists
|
||||||
ldx #1
|
inx
|
||||||
stx $D000
|
stx $D000
|
||||||
sta setAuxZP
|
sta setAuxZP
|
||||||
inx
|
inx
|
||||||
stx $D000
|
stx $D000
|
||||||
lda $D000
|
cpx $D000
|
||||||
cmp #2
|
|
||||||
bne .noaux
|
bne .noaux
|
||||||
sta clrAuxZP
|
sta clrAuxZP
|
||||||
lda $D000
|
dex
|
||||||
cmp #1
|
cpx $D000
|
||||||
beq .gotaux
|
beq .gotaux
|
||||||
.noaux jsr inlineFatal : !text "AuxMemReq",0
|
.noaux jsr inlineFatal : !text "AuxMemReq",0
|
||||||
.gotaux ldy #0
|
.gotaux ldx #$D0
|
||||||
ldx #$D0
|
|
||||||
.pglup stx .ld+2
|
.pglup stx .ld+2
|
||||||
stx .st+2
|
stx .st+2
|
||||||
.bylup sta clrAuxZP ; get byte from main LC
|
.bylup sta clrAuxZP ; get byte from main LC
|
||||||
@ -111,30 +109,27 @@ relocate:
|
|||||||
bne .pglup
|
bne .pglup
|
||||||
sta clrAuxZP ; ...back to main LC
|
sta clrAuxZP ; ...back to main LC
|
||||||
; patch into the main ProDOS MLI entry point
|
; patch into the main ProDOS MLI entry point
|
||||||
lda #$4C ; jmp
|
ldx #$4C ; jmp
|
||||||
sta $BFBB
|
stx $BFBB
|
||||||
lda #<enterProDOS1
|
lda #<enterProDOS1
|
||||||
sta $BFBC
|
sta $BFBC
|
||||||
lda #>enterProDOS1
|
lda #>enterProDOS1
|
||||||
sta $BFBD
|
sta $BFBD
|
||||||
; patch into the interrupt handler
|
; patch into the interrupt handler
|
||||||
lda #$4C ; jmp
|
stx $BFEB
|
||||||
sta $BFEB
|
|
||||||
lda #<enterProDOS2
|
lda #<enterProDOS2
|
||||||
sta $BFEC
|
sta $BFEC
|
||||||
lda #>enterProDOS2
|
lda #>enterProDOS2
|
||||||
sta $BFED
|
sta $BFED
|
||||||
; patch into the shared MLI/IRQ exit routine
|
; patch into the shared MLI/IRQ exit routine
|
||||||
lda #$4C ; jmp
|
stx $BFA0
|
||||||
sta $BFA0
|
|
||||||
lda #<exitProDOS
|
lda #<exitProDOS
|
||||||
sta $BFA1
|
sta $BFA1
|
||||||
lda #>exitProDOS
|
lda #>exitProDOS
|
||||||
sta $BFA2
|
sta $BFA2
|
||||||
; now blow away the main RAM LC area as a check
|
; now blow away the main RAM LC area as a check
|
||||||
ldx #$D0
|
ldx #$D0
|
||||||
lda #0
|
tya
|
||||||
tay
|
|
||||||
.clrlup stx .st2+2
|
.clrlup stx .st2+2
|
||||||
.st2 sta $D000,Y
|
.st2 sta $D000,Y
|
||||||
iny
|
iny
|
||||||
@ -289,7 +284,7 @@ init: !zone
|
|||||||
stx tSegLink+1
|
stx tSegLink+1
|
||||||
inx
|
inx
|
||||||
stx tSegLink+2
|
stx tSegLink+2
|
||||||
ldx #4
|
inx
|
||||||
stx tSegLink+0
|
stx tSegLink+0
|
||||||
inx
|
inx
|
||||||
stx tSegLink+4
|
stx tSegLink+4
|
||||||
@ -323,12 +318,10 @@ init: !zone
|
|||||||
; Finally, form a long list of the remaining unused segments.
|
; Finally, form a long list of the remaining unused segments.
|
||||||
ldx #10
|
ldx #10
|
||||||
stx unusedSeg ; that's the first unused seg
|
stx unusedSeg ; that's the first unused seg
|
||||||
ldy #11
|
.loop: inx
|
||||||
.loop: tya
|
txa
|
||||||
sta tSegLink,x
|
sta tSegLink-1,x
|
||||||
inx
|
cpx #MAX_SEGS-1 ; did all segments yet?
|
||||||
iny
|
|
||||||
cpy #MAX_SEGS ; did all segments yet?
|
|
||||||
bne .loop ; no, loop again
|
bne .loop ; no, loop again
|
||||||
; Allocate space for the PLASMA frame stack
|
; Allocate space for the PLASMA frame stack
|
||||||
!if SANITY_CHECK {
|
!if SANITY_CHECK {
|
||||||
@ -636,19 +629,21 @@ __asmPlasm_bank2:
|
|||||||
bit setLcRW+lcBank2
|
bit setLcRW+lcBank2
|
||||||
bit setLcRW+lcBank2
|
bit setLcRW+lcBank2
|
||||||
__asmPlasm: !zone
|
__asmPlasm: !zone
|
||||||
pla ; save address of calling routine, so we can call it
|
cpx #$11
|
||||||
clc
|
bcs .badx ; X must be in range 0..$10
|
||||||
adc #1
|
|
||||||
sta .jsr+1
|
|
||||||
pla
|
|
||||||
adc #0
|
|
||||||
sta .jsr+2
|
|
||||||
; adjust PLASMA stack pointer to skip over params
|
; adjust PLASMA stack pointer to skip over params
|
||||||
dey ; leave 1 slot for ret value
|
dey ; leave 1 slot for ret value
|
||||||
sty tmp
|
sty tmp
|
||||||
|
pla ; save address of calling routine, so we can call it
|
||||||
|
tay
|
||||||
|
pla
|
||||||
|
iny
|
||||||
|
sty .jsr+1
|
||||||
|
bne .noadd
|
||||||
|
adc #1
|
||||||
|
.noadd
|
||||||
|
sta .jsr+2
|
||||||
txa
|
txa
|
||||||
cpx #$11
|
|
||||||
bcs .badx ; X must be in range 0..$10
|
|
||||||
.add adc tmp ; carry cleared by cpx above
|
.add adc tmp ; carry cleared by cpx above
|
||||||
pha ; and save that
|
pha ; and save that
|
||||||
cmp #$11 ; again, X must be in range 0..$10
|
cmp #$11 ; again, X must be in range 0..$10
|
||||||
@ -1002,8 +997,8 @@ gcHash_chk: !zone
|
|||||||
sta gcHash_link,y
|
sta gcHash_link,y
|
||||||
tya
|
tya
|
||||||
sta gcHash_first,x
|
sta gcHash_first,x
|
||||||
.ret clc
|
clc
|
||||||
rts
|
.ret rts
|
||||||
.found sec
|
.found sec
|
||||||
rts
|
rts
|
||||||
.corrup jmp heapCorrupt
|
.corrup jmp heapCorrupt
|
||||||
@ -1621,7 +1616,7 @@ reset: !zone
|
|||||||
.next: lda tSegLink,x ; get link to next seg
|
.next: lda tSegLink,x ; get link to next seg
|
||||||
tax ; to X reg, and test if end of chain (x=0)
|
tax ; to X reg, and test if end of chain (x=0)
|
||||||
bne .inactivate ; no, not end of chain, so loop again
|
bne .inactivate ; no, not end of chain, so loop again
|
||||||
lda #0 ; default to putting fixups at $8000, to avoid fragmentation
|
;; lda #0 ; default to putting fixups at $8000, to avoid fragmentation
|
||||||
sta fixupHint
|
sta fixupHint
|
||||||
lda #$80
|
lda #$80
|
||||||
sta fixupHint+1
|
sta fixupHint+1
|
||||||
|
@ -182,10 +182,10 @@ GA_Lp2 LDY zTmp3 ;Get index into stored addresses
|
|||||||
AND #$07 ;check if it crosses the 'n'* 7th line
|
AND #$07 ;check if it crosses the 'n'* 7th line
|
||||||
BEQ GA_Lp1 ;if so, use ROM to recalc new addrs, else,
|
BEQ GA_Lp1 ;if so, use ROM to recalc new addrs, else,
|
||||||
LDA GBasH ;get HiByt of adrs wrd |pppFGHcd|eABABxxx|
|
LDA GBasH ;get HiByt of adrs wrd |pppFGHcd|eABABxxx|
|
||||||
CLC ;(line position is ABCDEFGH bit pattern)
|
;; CLC ;(line position is ABCDEFGH bit pattern)
|
||||||
ADC #$04 ;increment the FGH bit pattern
|
ADC #$04 ;increment the FGH bit pattern
|
||||||
STA GBasH ;and save the result. This is faster
|
STA GBasH ;and save the result. This is faster
|
||||||
JMP GA_Lp2 ;than using the GetBase routine every time.
|
BNE GA_Lp2 ;than using the GetBase routine every time.
|
||||||
GA_Done PLA ;restore vertical position
|
GA_Done PLA ;restore vertical position
|
||||||
STA CursRow
|
STA CursRow
|
||||||
RTS
|
RTS
|
||||||
@ -241,7 +241,6 @@ GetWdth LDA #0
|
|||||||
TAY
|
TAY
|
||||||
STA ChrX10H ;clear HI byte of x10 multiplier
|
STA ChrX10H ;clear HI byte of x10 multiplier
|
||||||
LDA PltChar ;load the font char {0..110}
|
LDA PltChar ;load the font char {0..110}
|
||||||
CLC
|
|
||||||
ASL
|
ASL
|
||||||
STA ChrX10L ;multiply it by 10 to get an index value
|
STA ChrX10L ;multiply it by 10 to get an index value
|
||||||
ASL ;into the array of bytes that make-up the
|
ASL ;into the array of bytes that make-up the
|
||||||
@ -250,10 +249,9 @@ GetWdth LDA #0
|
|||||||
ROL ChrX10H
|
ROL ChrX10H
|
||||||
ADC ChrX10L
|
ADC ChrX10L
|
||||||
STA ChrX10L
|
STA ChrX10L
|
||||||
LDA ChrX10H
|
BNE +
|
||||||
ADC #0
|
INC ChrX10H ;save index value {0..990}
|
||||||
STA ChrX10H ;save index value {0..990}
|
+
|
||||||
|
|
||||||
CLC
|
CLC
|
||||||
LDA Font0 ;get base address of Font bitmap table
|
LDA Font0 ;get base address of Font bitmap table
|
||||||
ADC ChrX10L ;and add the PlotChar x10 offset to it
|
ADC ChrX10L ;and add the PlotChar x10 offset to it
|
||||||
@ -350,7 +348,7 @@ LpLBmp ASL ;into the CGA_Ary flag. That CGA_Ary value is
|
|||||||
; now shift the pixel pattrn back 1 positn
|
; now shift the pixel pattrn back 1 positn
|
||||||
LSR ;so all pixels are visible [8th bit not
|
LSR ;so all pixels are visible [8th bit not
|
||||||
STA zTmp3 ;visible]. Save the pixel pattern.
|
STA zTmp3 ;visible]. Save the pixel pattern.
|
||||||
CPY #1
|
DEY
|
||||||
BNE LpLMskp ;Only shift mask bits on 1st loop
|
BNE LpLMskp ;Only shift mask bits on 1st loop
|
||||||
|
|
||||||
LDX H_Bit ;Do the same shifting for the mask bits.
|
LDX H_Bit ;Do the same shifting for the mask bits.
|
||||||
@ -394,50 +392,43 @@ DoAgn PHA
|
|||||||
STA (zTmp1),Y ;write to HGR. Use indrct, indxd adrssing
|
STA (zTmp1),Y ;write to HGR. Use indrct, indxd adrssing
|
||||||
LDA Flg2nd ;check if pixel pattern crosses 2-bytes
|
LDA Flg2nd ;check if pixel pattern crosses 2-bytes
|
||||||
BEQ Chk8xcp ;if not, then skip to next line of bitmap
|
BEQ Chk8xcp ;if not, then skip to next line of bitmap
|
||||||
LDA #0
|
STY Flg2nd ;else, first, clear the flag
|
||||||
STA Flg2nd ;else, first, clear the flag
|
|
||||||
LDA Byt2nd ;get the 2nd byte
|
LDA Byt2nd ;get the 2nd byte
|
||||||
STA zTmp3 ;store it in pixel pattern to be plotted
|
STA zTmp3 ;store it in pixel pattern to be plotted
|
||||||
LDA MskBytH
|
LDA MskBytH
|
||||||
INY ;increment the byte offset index
|
INY ;increment the byte offset index
|
||||||
JMP DoAgn ;go plot the 2nd half of the pixel pattern
|
BNE DoAgn ;go plot the 2nd half of the pixel pattern
|
||||||
Chk8xcp LDA Flg8xcp
|
Chk8xcp CMP InvTx_Flg ;save carry for later
|
||||||
|
LDA Flg8xcp
|
||||||
BEQ SkpLine
|
BEQ SkpLine
|
||||||
INY
|
INY
|
||||||
LDA InvTx_Flg
|
|
||||||
BNE Chk8xcI
|
|
||||||
LDA (zTmp1),Y
|
LDA (zTmp1),Y
|
||||||
|
BCC Chk8xcI ;CMP was non-zero
|
||||||
AND #$FE
|
AND #$FE
|
||||||
STA (zTmp1),Y
|
STA (zTmp1),Y
|
||||||
JMP SkpLine
|
BCS SkpLine
|
||||||
Chk8xcI LDA (zTmp1),Y
|
Chk8xcI ORA #1
|
||||||
ORA #1
|
|
||||||
STA (zTmp1),Y
|
STA (zTmp1),Y
|
||||||
JMP SkpLine
|
BNE SkpLine
|
||||||
|
|
||||||
NoMask LDY #0 ;clear the byte offset index
|
NoMask ;;LDY #0 ;clear the byte offset index
|
||||||
DoAgnNM LDA (zTmp1),Y ;get HGR pixels
|
DoAgnNM LDA FlgBchr
|
||||||
PHA
|
|
||||||
LDA FlgBchr
|
|
||||||
BEQ NoBchrP
|
BEQ NoBchrP
|
||||||
LDA zTmp3
|
LDA zTmp3
|
||||||
EOR #$FF
|
EOR #$FF
|
||||||
|
AND (zTmp1),Y ;get HGR pixels
|
||||||
STA zTmp3
|
STA zTmp3
|
||||||
PLA
|
NoBchrP LDA (zTmp1),Y ;get HGR pixels
|
||||||
AND zTmp3
|
|
||||||
JMP NoBchrQ
|
|
||||||
NoBchrP PLA
|
|
||||||
ORA zTmp3 ;add the char BMP bits into the pixels
|
ORA zTmp3 ;add the char BMP bits into the pixels
|
||||||
NoBchrQ ORA #$80 ; (set high bit for the demo)
|
ORA #$80 ; (set high bit for the demo)
|
||||||
STA (zTmp1),Y ;write to HGR. Use indrct, indxd adrssing
|
STA (zTmp1),Y ;write to HGR. Use indrct, indxd adrssing
|
||||||
LDA Flg2nd ;check if pixel pattern crosses 2-bytes
|
LDA Flg2nd ;check if pixel pattern crosses 2-bytes
|
||||||
BEQ SkpLine ;if not, then skip to next line of bitmap
|
BEQ SkpLine ;if not, then skip to next line of bitmap
|
||||||
LDA #0
|
STY Flg2nd ;else, first, clear the flag
|
||||||
STA Flg2nd ;else, first, clear the flag
|
|
||||||
LDA Byt2nd ;get the 2nd byte
|
LDA Byt2nd ;get the 2nd byte
|
||||||
STA zTmp3 ;store it in pixel pattern to be plotted
|
STA zTmp3 ;store it in pixel pattern to be plotted
|
||||||
INY ;increment the byte offset index
|
INY ;increment the byte offset index
|
||||||
JMP DoAgnNM ;go plot the 2nd half of the pixel pattern
|
BNE DoAgnNM ;go plot the 2nd half of the pixel pattern
|
||||||
|
|
||||||
SkpLine INX ;increment the array index
|
SkpLine INX ;increment the array index
|
||||||
STX MlpIdx
|
STX MlpIdx
|
||||||
@ -496,16 +487,14 @@ Adv210 STA CursColL ;position to 154
|
|||||||
STA WrdWdth ;and, clear Word Width total
|
STA WrdWdth ;and, clear Word Width total
|
||||||
STA TtlScrl ;and ticker scroll total
|
STA TtlScrl ;and ticker scroll total
|
||||||
LDA CursRow ;Get vertical {0..191}
|
LDA CursRow ;Get vertical {0..191}
|
||||||
CLC
|
|
||||||
ADC #9 ;increment by 9 lines, down
|
ADC #9 ;increment by 9 lines, down
|
||||||
CMP CursYb ;check if it's past 130
|
CMP CursYb ;check if it's past 130
|
||||||
BCC DoneLin ;if not then done
|
BCC DoneLin ;if not then done
|
||||||
JSR ScrlTxt ;else scroll the text up 1 line
|
JMP ScrlTxt ;else scroll the text up 1 line
|
||||||
RTS
|
|
||||||
DoneLin STA CursRow ;save vertical position
|
DoneLin STA CursRow ;save vertical position
|
||||||
DoneCurs LDA CharRate ;get character rate / delay time
|
DoneCurs LDA CharRate ;get character rate / delay time
|
||||||
BEQ Wait_skp ;skip if no wait
|
BEQ Wait_skp ;skip if no wait
|
||||||
JSR WtL_Wait ;delay before plotting next char
|
JMP WtL_Wait ;delay before plotting next char
|
||||||
Wait_skp RTS
|
Wait_skp RTS
|
||||||
|
|
||||||
;Wait that can be interrupted by a key or button press.
|
;Wait that can be interrupted by a key or button press.
|
||||||
@ -557,14 +546,14 @@ SW_TOP = 3
|
|||||||
SetWnd LDA evalStkL+SW_TOP,X ;get top coord
|
SetWnd LDA evalStkL+SW_TOP,X ;get top coord
|
||||||
STA CursY ;save the top Y coord
|
STA CursY ;save the top Y coord
|
||||||
STA CursRow ;also as current cursor vertical pos
|
STA CursRow ;also as current cursor vertical pos
|
||||||
SEC
|
TAY
|
||||||
SBC #1 ;adjust by 1
|
DEY ;adjust by 1
|
||||||
STA TpMrgn ; for scrolling margin
|
STY TpMrgn ; for scrolling margin
|
||||||
LDA evalStkL+SW_BTM,X ;get bottom coord
|
LDA evalStkL+SW_BTM,X ;get bottom coord
|
||||||
STA CursYb ;save the bottom Y coord
|
STA CursYb ;save the bottom Y coord
|
||||||
SEC
|
TAY
|
||||||
SBC #1 ;adjust by 1
|
DEY ;adjust by 1
|
||||||
STA BtMrgn ; for scrolling margin
|
STY BtMrgn ; for scrolling margin
|
||||||
LDA evalStkL+SW_LT,X ;lo byte of left X
|
LDA evalStkL+SW_LT,X ;lo byte of left X
|
||||||
STA CursXl
|
STA CursXl
|
||||||
LDA evalStkH+SW_LT,X ;hi byte of left X
|
LDA evalStkH+SW_LT,X ;hi byte of left X
|
||||||
@ -696,12 +685,10 @@ ClrSlp4 STA (GBasL),Y
|
|||||||
RTS
|
RTS
|
||||||
|
|
||||||
ClrChkF LDA BkgColor
|
ClrChkF LDA BkgColor
|
||||||
TAY
|
|
||||||
AND #$7F
|
AND #$7F
|
||||||
EOR #$7F
|
EOR #$7F
|
||||||
BEQ ClrChk1
|
BEQ ClrChk1
|
||||||
TYA
|
EOR #$7F
|
||||||
AND #$7F
|
|
||||||
ClrChk1 STA ClrFlpF
|
ClrChk1 STA ClrFlpF
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@ -743,8 +730,7 @@ Pa_Lp1 STY Pa_iSv
|
|||||||
STA AscChar
|
STA AscChar
|
||||||
CPY Pa_Len ;reached end of string?
|
CPY Pa_Len ;reached end of string?
|
||||||
BCC Pa_Go
|
BCC Pa_Go
|
||||||
BEQ Pa_Go
|
BNE Pa_Spc
|
||||||
JMP Pa_Spc
|
|
||||||
Pa_Go ORA #$80 ;set hi bit for consistent tests
|
Pa_Go ORA #$80 ;set hi bit for consistent tests
|
||||||
STA AscChar
|
STA AscChar
|
||||||
CMP #$8D
|
CMP #$8D
|
||||||
@ -767,7 +753,7 @@ Pa_Tskp LDA AscChar
|
|||||||
BPL Pa_ToFr ;too far! force CR/LF
|
BPL Pa_ToFr ;too far! force CR/LF
|
||||||
LDY Pa_iSv
|
LDY Pa_iSv
|
||||||
INY
|
INY
|
||||||
JMP Pa_Lp1
|
BNE Pa_Lp1
|
||||||
Pa_ToFr !if DEBUG { +prChr '+' }
|
Pa_ToFr !if DEBUG { +prChr '+' }
|
||||||
;MH: I added this, but it doesn't actually work. Skips first char on line sometimes.
|
;MH: I added this, but it doesn't actually work. Skips first char on line sometimes.
|
||||||
;LDY Pa_iSv ;if word too big
|
;LDY Pa_iSv ;if word too big
|
||||||
@ -777,10 +763,10 @@ Pa_ToFr !if DEBUG { +prChr '+' }
|
|||||||
STA AscChar
|
STA AscChar
|
||||||
!if DEBUG { +prChr '!' : ora #$80 : jsr cout }
|
!if DEBUG { +prChr '!' : ora #$80 : jsr cout }
|
||||||
JSR TestChr
|
JSR TestChr
|
||||||
LDY #0
|
|
||||||
STY TtlWdth
|
|
||||||
LDY Pa_iBgn
|
LDY Pa_iBgn
|
||||||
JMP Pa_Lp0
|
LDA #0
|
||||||
|
STA TtlWdth
|
||||||
|
BEQ Pa_Lp1
|
||||||
;
|
;
|
||||||
Pa_Spc LDY Pa_iSv
|
Pa_Spc LDY Pa_iSv
|
||||||
STY Pa_iEnd
|
STY Pa_iEnd
|
||||||
@ -799,8 +785,7 @@ Pa_Lp2 STY Pa_iSv
|
|||||||
Pa_Dn2 STY Pa_iSv
|
Pa_Dn2 STY Pa_iSv
|
||||||
CPY Pa_Len ;end of the message?
|
CPY Pa_Len ;end of the message?
|
||||||
BCC Pa_Dn2b
|
BCC Pa_Dn2b
|
||||||
BEQ Pa_Dn2b
|
BNE ParsDn ;if so, stop here
|
||||||
JMP ParsDn ;if so, stop here
|
|
||||||
Pa_Dn2b LDA TtlWdth
|
Pa_Dn2b LDA TtlWdth
|
||||||
CMP LinWdth
|
CMP LinWdth
|
||||||
BPL Pa_Dn3
|
BPL Pa_Dn3
|
||||||
@ -907,10 +892,9 @@ CtrSLps STA LpNScrl ;Save # of scroll loops
|
|||||||
SEC ;(CLC is intentional, here)
|
SEC ;(CLC is intentional, here)
|
||||||
SBC LpNScrl ;bump it back
|
SBC LpNScrl ;bump it back
|
||||||
STA CursColL ;save lo-byte
|
STA CursColL ;save lo-byte
|
||||||
LDA CursColH ;get hi-byte of {0..279}
|
BCS +
|
||||||
SBC #0
|
DEC CursColH ;get hi-byte of {0..279}
|
||||||
STA CursColH
|
+ LDA LpNScrl ;Get # of scroll loops
|
||||||
LDA LpNScrl ;Get # of scroll loops
|
|
||||||
CtrLp1 JSR Sc1_Bgn
|
CtrLp1 JSR Sc1_Bgn
|
||||||
DEC LpNScrl
|
DEC LpNScrl
|
||||||
BNE CtrLp1
|
BNE CtrLp1
|
||||||
@ -1040,7 +1024,7 @@ Get_Ext CMP #$85
|
|||||||
BNE Get_Ch3 ;Ctrl-E (extended char)
|
BNE Get_Ch3 ;Ctrl-E (extended char)
|
||||||
LDA #3
|
LDA #3
|
||||||
STA WaitStat ;if pressed, wait for val
|
STA WaitStat ;if pressed, wait for val
|
||||||
JMP Get_Lp1
|
BNE Get_Lp1
|
||||||
Get_Ch3 LDX InBfrX ;else normal char pressed
|
Get_Ch3 LDX InBfrX ;else normal char pressed
|
||||||
STA InBufr,X ;store ASCII char w/hi-bit
|
STA InBufr,X ;store ASCII char w/hi-bit
|
||||||
AND #$7F ;strip off hi-bit
|
AND #$7F ;strip off hi-bit
|
||||||
@ -1112,7 +1096,7 @@ In_cTst CMP #$85
|
|||||||
BNE In_cTs2 ;Ctrl-E (extended char)
|
BNE In_cTs2 ;Ctrl-E (extended char)
|
||||||
LDA #3 ;set wait state for extended char
|
LDA #3 ;set wait state for extended char
|
||||||
STA WaitStat
|
STA WaitStat
|
||||||
JMP In_Key
|
BNE In_Key
|
||||||
In_cTs2 CMP #$9B ;check for ESC key
|
In_cTs2 CMP #$9B ;check for ESC key
|
||||||
BNE In_cTs3 ;if ESC then exit app
|
BNE In_cTs3 ;if ESC then exit app
|
||||||
PLA
|
PLA
|
||||||
@ -1156,9 +1140,8 @@ In_Plt LDX #1
|
|||||||
STA CursColH
|
STA CursColH
|
||||||
CMP CursXrh ;if so, ignore it, sound ERR,
|
CMP CursXrh ;if so, ignore it, sound ERR,
|
||||||
BMI In_Bchk ;wait for different key press
|
BMI In_Bchk ;wait for different key press
|
||||||
CLC
|
|
||||||
LDA CursColL ;allow 2 more pixels for cursor
|
LDA CursColL ;allow 2 more pixels for cursor
|
||||||
ADC #2
|
ADC #1
|
||||||
CMP CursXrl
|
CMP CursXrl
|
||||||
BPL In_Err
|
BPL In_Err
|
||||||
In_Bchk LDX InBfrMx
|
In_Bchk LDX InBfrMx
|
||||||
@ -1176,8 +1159,7 @@ In_Bfr LDX InBfrX
|
|||||||
STX InBfrX
|
STX InBfrX
|
||||||
LDX #0
|
LDX #0
|
||||||
STX ChBflip ;reset cursor s=ence
|
STX ChBflip ;reset cursor s=ence
|
||||||
JSR CurBplt ;erase cursor
|
JMP CurBplt ;erase cursor
|
||||||
RTS
|
|
||||||
In_SvCh JSR In_Bfr
|
In_SvCh JSR In_Bfr
|
||||||
LDA NwPChar ;restore new plot char
|
LDA NwPChar ;restore new plot char
|
||||||
STA PltChar
|
STA PltChar
|
||||||
@ -1221,10 +1203,9 @@ In_DEL LDX InBfrX ;get buffer index
|
|||||||
LDA CursColL ;subtract char width from
|
LDA CursColL ;subtract char width from
|
||||||
SBC ChrWdth ;cursor position, to reposition
|
SBC ChrWdth ;cursor position, to reposition
|
||||||
STA CursColL ;cursor one char to the left
|
STA CursColL ;cursor one char to the left
|
||||||
LDA CursColH
|
BCS +
|
||||||
SBC #0
|
DEC CursColH
|
||||||
STA CursColH
|
+ JSR In_sCur ;save new cursor position
|
||||||
JSR In_sCur ;save new cursor position
|
|
||||||
LDA ChBufr,X ;get char from buffer
|
LDA ChBufr,X ;get char from buffer
|
||||||
STA PltChar ;save it
|
STA PltChar ;save it
|
||||||
LDX #$80
|
LDX #$80
|
||||||
@ -1403,13 +1384,10 @@ TCl_15 CMP #$08 ;Ctrl-H left arrow
|
|||||||
RTS
|
RTS
|
||||||
TCl_15a LDA Tikr_Flg
|
TCl_15a LDA Tikr_Flg
|
||||||
BNE TCl_15t ;if not using ticker
|
BNE TCl_15t ;if not using ticker
|
||||||
SEC ;then move cursor left one dot
|
LDA CursColL ;then move cursor left one dot
|
||||||
LDA CursColL
|
BNE +
|
||||||
SBC #1
|
DEC CursColH
|
||||||
STA CursColL
|
+ DEC CursColL
|
||||||
LDA CursColH
|
|
||||||
SBC #0
|
|
||||||
STA CursColH
|
|
||||||
SEC
|
SEC
|
||||||
LDA CursXl
|
LDA CursXl
|
||||||
SBC CursColL
|
SBC CursColL
|
||||||
@ -1474,7 +1452,6 @@ TCl_20 CMP #$0E ;Ctrl-N normal txt mode
|
|||||||
STA UndTx_Flg
|
STA UndTx_Flg
|
||||||
STA CtrJs_Flg
|
STA CtrJs_Flg
|
||||||
STA CharRate
|
STA CharRate
|
||||||
LDA #0
|
|
||||||
STA BkgColor
|
STA BkgColor
|
||||||
TCl_XX RTS
|
TCl_XX RTS
|
||||||
|
|
||||||
@ -1530,17 +1507,11 @@ Wp_StClr TXA ;restore the alpha char
|
|||||||
SEC
|
SEC
|
||||||
SBC #$30 ;change Chr"#" to Val#
|
SBC #$30 ;change Chr"#" to Val#
|
||||||
AND #$1F ;mask off most letters/chars
|
AND #$1F ;mask off most letters/chars
|
||||||
TAX ;save 'dirty' Val#
|
CMP #$10 ;check of 'dirty' Val#
|
||||||
AND #$0F ;strip off low nibble
|
AND #$0F ;strip off low nibble
|
||||||
TAY ;save color
|
BCC WpClrOk ;shift to #
|
||||||
TXA ;restore Acc
|
Wp_Ashft ;;CLC ;which is 'A..F'
|
||||||
AND #$10 ;mask to check of letter
|
ADC #8 ;shift to numeric =ivalent
|
||||||
BNE Wp_Ashft ;alpha shift to #
|
|
||||||
TYA ;restore color
|
|
||||||
JMP WpClrOk
|
|
||||||
Wp_Ashft TYA ;restor masked 'dirty' val
|
|
||||||
CLC ;which is 'A..F'
|
|
||||||
ADC #9 ;shift to numeric =ivalent
|
|
||||||
AND #$07 ;mask it to be safe
|
AND #$07 ;mask it to be safe
|
||||||
WpClrOk TAX
|
WpClrOk TAX
|
||||||
LDA HclrTbl,X
|
LDA HclrTbl,X
|
||||||
@ -1578,6 +1549,7 @@ Wp_CFnt TXA ;restore alpha char
|
|||||||
SEC
|
SEC
|
||||||
SBC #$30 ;change Chr"#" to Val#
|
SBC #$30 ;change Chr"#" to Val#
|
||||||
AND #$03 ;mask off digit
|
AND #$03 ;mask off digit
|
||||||
|
;;pf: this CMP is broken
|
||||||
CMP #4
|
CMP #4
|
||||||
BEQ Wp_CfDn
|
BEQ Wp_CfDn
|
||||||
; STA Slct_Fnt ;store the font selection
|
; STA Slct_Fnt ;store the font selection
|
||||||
@ -1597,19 +1569,17 @@ Wp_CfDn RTS ;JMP Wpr_Clr
|
|||||||
Flg_PsC !byte 0 ;flag: plot separator char
|
Flg_PsC !byte 0 ;flag: plot separator char
|
||||||
;
|
;
|
||||||
Wp_Tab TXA ;restore alpha char
|
Wp_Tab TXA ;restore alpha char
|
||||||
CMP #$30 ;is alpha char < '0'?
|
SEC
|
||||||
BMI Wp_CkPrm2 ;if so then ## delimited
|
SBC #$30 ;attempt to change Chr"#" to Val#
|
||||||
CMP #$3A ;is alpha char > '9'?
|
BCC Wp_CkPrm2 ;alpha char < '0', so ## delimited
|
||||||
|
CMP #$0A ;is alpha char > '9'?
|
||||||
BPL Wp_CkPrm2 ;if so then ## delimited
|
BPL Wp_CkPrm2 ;if so then ## delimited
|
||||||
SEC ;else get tab ##
|
|
||||||
SBC #$30 ;change Chr"#" to Val#
|
|
||||||
AND #$0F ;mask off digit
|
|
||||||
LDX Flg_Prm2
|
LDX Flg_Prm2
|
||||||
BNE Wp_Tdg2 ;is 1st of 3 digits?
|
BNE Wp_Tdg2 ;is 1st of 3 digits?
|
||||||
STA Wp_Dig1 ;if so, save in Dig1
|
STA Wp_Dig1 ;if so, save in Dig1
|
||||||
INC Flg_Prm2 ;inc index of parm digit #
|
INC Flg_Prm2 ;inc index of parm digit #
|
||||||
RTS
|
RTS
|
||||||
Wp_Tdg2 CPX #1
|
Wp_Tdg2 DEX
|
||||||
BNE Wp_Tdg3 ;is 2nd of 3 digits?
|
BNE Wp_Tdg3 ;is 2nd of 3 digits?
|
||||||
STA Wp_Dig2 ;if so, save in Dig2
|
STA Wp_Dig2 ;if so, save in Dig2
|
||||||
INC Flg_Prm2 ;inc index of parm digit #
|
INC Flg_Prm2 ;inc index of parm digit #
|
||||||
@ -1620,12 +1590,12 @@ Wp_CkPrm2 LDX Flg_Prm2 ;check index value
|
|||||||
BNE Wp_CmbNz ;non-zero number of digits
|
BNE Wp_CmbNz ;non-zero number of digits
|
||||||
JMP Wp_LdHtVt ;when no digits, load margin
|
JMP Wp_LdHtVt ;when no digits, load margin
|
||||||
;combine the parm digits - from none, up to 3 digits
|
;combine the parm digits - from none, up to 3 digits
|
||||||
Wp_CmbNz CPX #1
|
Wp_CmbNz DEX
|
||||||
BNE Wp_CmbN2 ;is parm single digit?
|
BNE Wp_CmbN2 ;is parm single digit?
|
||||||
LDA Wp_Dig1
|
LDA Wp_Dig1
|
||||||
STA T1_vLo ;if so, then use it as low byte
|
STA T1_vLo ;if so, then use it as low byte
|
||||||
JMP Wp_CkHtVt ;check hTab/vTab value
|
JMP Wp_CkHtVt ;check hTab/vTab value
|
||||||
Wp_CmbN2 CPX #2
|
Wp_CmbN2 DEX
|
||||||
BNE Wp_CmbN3 ;is parm 2-digit?
|
BNE Wp_CmbN3 ;is parm 2-digit?
|
||||||
LDA Wp_Dig1
|
LDA Wp_Dig1
|
||||||
JSR Wp_Tmx10 ;multiply 1st digit by 10
|
JSR Wp_Tmx10 ;multiply 1st digit by 10
|
||||||
@ -1670,7 +1640,7 @@ Wp_CfHtVt STA Flg_PsC ;set Plot Separator flag
|
|||||||
BNE Wp_VtVal ;no - then go do vTab
|
BNE Wp_VtVal ;no - then go do vTab
|
||||||
LDA T1_vLo ;yes - then hTab
|
LDA T1_vLo ;yes - then hTab
|
||||||
;
|
;
|
||||||
CLC ;hTAB: get param add it to
|
;; CLC ;hTAB: get param add it to
|
||||||
ADC CursXl ;left window margin {0..278}
|
ADC CursXl ;left window margin {0..278}
|
||||||
STA CursColL ;move plot cursor from the
|
STA CursColL ;move plot cursor from the
|
||||||
LDA T1_vHi ;left margin to the tab value
|
LDA T1_vHi ;left margin to the tab value
|
||||||
@ -1715,13 +1685,11 @@ Wp_cRate TXA ;restore alpha char
|
|||||||
SEC
|
SEC
|
||||||
SBC #$30 ;change Chr"#" to Val#
|
SBC #$30 ;change Chr"#" to Val#
|
||||||
AND #$1F ;mask off digit
|
AND #$1F ;mask off digit
|
||||||
TAX
|
|
||||||
CMP #10 ;digit >9
|
CMP #10 ;digit >9
|
||||||
BMI Wp_RvOk ;no - ok
|
BMI Wp_RvOk ;no - ok
|
||||||
SEC
|
|
||||||
SBC #7 ;make A..F be 11..15
|
SBC #7 ;make A..F be 11..15
|
||||||
TAX
|
Wp_RvOk TAX
|
||||||
Wp_RvOk LDA Flg_Prm2 ;is 2nd of 2 digits?
|
LDA Flg_Prm2 ;is 2nd of 2 digits?
|
||||||
BNE Wp_rCmb ;yes - combine
|
BNE Wp_rCmb ;yes - combine
|
||||||
TXA ;no - clamp to {0..F}
|
TXA ;no - clamp to {0..F}
|
||||||
AND #$0F
|
AND #$0F
|
||||||
|
@ -147,7 +147,7 @@ log2_w_w: !zone
|
|||||||
|
|
||||||
; Same as above but with with 8-bit input instead of 16. Same output though.
|
; Same as above but with with 8-bit input instead of 16. Same output though.
|
||||||
log2_b_w: !zone
|
log2_b_w: !zone
|
||||||
cmp #0 ; special case: log(0) we call zero.
|
tax ; special case: log(0) we call zero.
|
||||||
beq .zero
|
beq .zero
|
||||||
.low: ; we know high byte is zero
|
.low: ; we know high byte is zero
|
||||||
ldx #7 ; start with exponent=7
|
ldx #7 ; start with exponent=7
|
||||||
@ -159,9 +159,8 @@ log2_b_w: !zone
|
|||||||
.gotMant: ; mantissa now in A, exponent in X. Translate mantissa to log using table, and we're done
|
.gotMant: ; mantissa now in A, exponent in X. Translate mantissa to log using table, and we're done
|
||||||
tay
|
tay
|
||||||
lda tbl_log2_w_w,y
|
lda tbl_log2_w_w,y
|
||||||
rts
|
.zero: rts
|
||||||
.zero: tax
|
|
||||||
rts
|
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; Calculate 2^n for a fixed-point n
|
; Calculate 2^n for a fixed-point n
|
||||||
@ -326,11 +325,11 @@ castRay: !zone
|
|||||||
sta dist ; is fractional byte of dist.
|
sta dist ; is fractional byte of dist.
|
||||||
lda mapX ; map X is the integer byte
|
lda mapX ; map X is the integer byte
|
||||||
sbc playerX+1
|
sbc playerX+1
|
||||||
|
tax
|
||||||
bit stepX
|
bit stepX
|
||||||
bpl +
|
bpl +
|
||||||
clc ; if stepping backward, add one to dist
|
inx ; if stepping backward, add one to dist
|
||||||
adc #1
|
+ stx dist+1
|
||||||
+ sta dist+1
|
|
||||||
ldx rayDirX ; parameters for wall calculation
|
ldx rayDirX ; parameters for wall calculation
|
||||||
ldy rayDirY
|
ldy rayDirY
|
||||||
lda stepY
|
lda stepY
|
||||||
@ -383,11 +382,11 @@ castRay: !zone
|
|||||||
sta dist ; is fractional byte of dist.
|
sta dist ; is fractional byte of dist.
|
||||||
lda mapY ; map X is the integer byte
|
lda mapY ; map X is the integer byte
|
||||||
sbc playerY+1
|
sbc playerY+1
|
||||||
|
tax
|
||||||
bit stepY
|
bit stepY
|
||||||
bpl +
|
bpl +
|
||||||
clc ; if stepping backward, add one to dist
|
inx ; if stepping backward, add one to dist
|
||||||
adc #1
|
+ stx dist+1
|
||||||
+ sta dist+1
|
|
||||||
ldx rayDirY ; parameters for wall calculation
|
ldx rayDirY ; parameters for wall calculation
|
||||||
ldy rayDirX
|
ldy rayDirX
|
||||||
lda stepX
|
lda stepX
|
||||||
@ -541,11 +540,11 @@ castRay: !zone
|
|||||||
ror
|
ror
|
||||||
pha ; stash it on stack (we don't have X reg free yet for indexed store)
|
pha ; stash it on stack (we don't have X reg free yet for indexed store)
|
||||||
jsr pow2_w_w ; calculate 2 ^ (log(64) - diff) =~ 64.0 / dist
|
jsr pow2_w_w ; calculate 2 ^ (log(64) - diff) =~ 64.0 / dist
|
||||||
cpx #0
|
tay ; save the height in Y reg
|
||||||
|
txa
|
||||||
beq +
|
beq +
|
||||||
lda #$FF ; clamp large line heights to 255
|
ldy #$FF ; clamp large line heights to 255
|
||||||
+ tay ; save the height in Y reg
|
+ pla ; get the depth back
|
||||||
pla ; get the depth back
|
|
||||||
jmp saveLink ; save final column data to link buffer
|
jmp saveLink ; save final column data to link buffer
|
||||||
|
|
||||||
!if DEBUG >= 2 {
|
!if DEBUG >= 2 {
|
||||||
@ -846,14 +845,13 @@ spriteCalc: !zone
|
|||||||
stx wSize+1
|
stx wSize+1
|
||||||
|
|
||||||
; Clamp wSize to form lineCt (height of final drawn sprite)
|
; Clamp wSize to form lineCt (height of final drawn sprite)
|
||||||
cpx #0
|
|
||||||
beq +
|
|
||||||
lda #$FF
|
|
||||||
+ sta lineCt
|
|
||||||
|
|
||||||
; Calculate wSpriteTop = 32 - (wSize >> 1);
|
|
||||||
tay ; stash lo byte of wSize
|
tay ; stash lo byte of wSize
|
||||||
txa ; work on hi byte
|
txa ; work on hi byte
|
||||||
|
beq +
|
||||||
|
ldy #$FF
|
||||||
|
+ sty lineCt
|
||||||
|
|
||||||
|
; Calculate wSpriteTop = 32 - (wSize >> 1);
|
||||||
lsr ; shift right 1 bit
|
lsr ; shift right 1 bit
|
||||||
tax ; save hi byte to X
|
tax ; save hi byte to X
|
||||||
tya ; work on lo byte
|
tya ; work on lo byte
|
||||||
@ -1366,10 +1364,9 @@ makeClrBlit: !zone
|
|||||||
clc
|
clc
|
||||||
adc #29*2
|
adc #29*2
|
||||||
sta pDst
|
sta pDst
|
||||||
lda pDst+1
|
bcc +
|
||||||
adc #0
|
inc pDst+1
|
||||||
sta pDst+1
|
+ iny
|
||||||
iny
|
|
||||||
iny
|
iny
|
||||||
cpy #64
|
cpy #64
|
||||||
bne .noSwitch
|
bne .noSwitch
|
||||||
@ -1443,14 +1440,10 @@ makeDecodeTbls: !zone
|
|||||||
sta tmp+1
|
sta tmp+1
|
||||||
; extract only bits 1 and 3 for the pixel data
|
; extract only bits 1 and 3 for the pixel data
|
||||||
txa
|
txa
|
||||||
and #8 ; bit 3
|
and #$0a ; bits 3 and 1
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr ; bit 1 -> carry
|
||||||
sta tmp
|
adc #0
|
||||||
txa
|
|
||||||
and #2 ; bit 1
|
|
||||||
lsr
|
|
||||||
ora tmp
|
|
||||||
.decodeTo01:
|
.decodeTo01:
|
||||||
ora tmp+1
|
ora tmp+1
|
||||||
sta decodeTo01,x
|
sta decodeTo01,x
|
||||||
@ -1643,11 +1636,11 @@ loadTextures: !zone
|
|||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; Plasma interface to texture control: 1 to load textures, 0 to unload
|
; Plasma interface to texture control: 1 to load textures, 0 to unload
|
||||||
pl_texControl: !zone {
|
pl_texControl: !zone {
|
||||||
cmp #0
|
tax
|
||||||
beq .unload
|
beq .unload
|
||||||
lda #0 ; don't re-init scripts
|
lda #0 ; don't re-init scripts
|
||||||
jmp loadTextures
|
jmp loadTextures
|
||||||
.unload ldx #0
|
.unload
|
||||||
- txa
|
- txa
|
||||||
pha
|
pha
|
||||||
ldy texAddrHi,x
|
ldy texAddrHi,x
|
||||||
@ -1966,14 +1959,14 @@ copyScreen: !zone
|
|||||||
; Parameters: @x, @y
|
; Parameters: @x, @y
|
||||||
; Returns: Nothing (but stores into the addressed variables)
|
; Returns: Nothing (but stores into the addressed variables)
|
||||||
pl_getPos: !zone {
|
pl_getPos: !zone {
|
||||||
lda playerY+1
|
ldy playerY+1
|
||||||
sec
|
dey ; adjust for border guards
|
||||||
sbc #1 ; adjust for border guards
|
tya
|
||||||
jsr .sto
|
jsr .sto
|
||||||
inx
|
inx
|
||||||
lda playerX+1
|
ldy playerX+1
|
||||||
sec
|
dey ; adjust for border guards
|
||||||
sbc #1 ; adjust for border guards
|
tya
|
||||||
; Now fall thru, and exit with X incremented once (2 params - 1 return slot = 1)
|
; Now fall thru, and exit with X incremented once (2 params - 1 return slot = 1)
|
||||||
.sto ldy evalStkL,x
|
.sto ldy evalStkL,x
|
||||||
sty pTmp
|
sty pTmp
|
||||||
|
@ -304,7 +304,7 @@ LOAD_SCRIPTS_NO_CALC:
|
|||||||
LDY #5
|
LDY #5
|
||||||
LDA (AVATAR_SECTION),Y ; check script module ID
|
LDA (AVATAR_SECTION),Y ; check script module ID
|
||||||
BNE .got ; if any, go load it
|
BNE .got ; if any, go load it
|
||||||
.none LDA #0 ; else, no scripts
|
.none ;;LDA #0 ; else, no scripts
|
||||||
STA SCRIPTS_LOC
|
STA SCRIPTS_LOC
|
||||||
STA SCRIPTS_LOC+1
|
STA SCRIPTS_LOC+1
|
||||||
RTS
|
RTS
|
||||||
|
Loading…
Reference in New Issue
Block a user