mode7: trim off some of the extra code

This commit is contained in:
Vince Weaver 2017-12-12 13:53:20 -05:00
parent 4724b09570
commit 598043e3ed
2 changed files with 0 additions and 227 deletions

View File

@ -63,114 +63,6 @@ memset_loop:
bne memset_loop
rts
;=================
; load RLE image
;=================
; Output is BASH/BASL
; Input is in GBASH/GBASL
load_rle_gr:
lda #$0
tax
tay ; init X and Y to 0
sta CV ; ycoord=0
lda (GBASL),y ; load xsize
sta CH
iny ; (we should check if we had
; bad luck and overflows page)
iny ; skip ysize
rle_loop:
lda (GBASL),y ; load run value
cmp #$ff ; if 0xff
beq rle_done ; we are done
sta RUN
iny ; point to next value
bne rle_yskip1 ; if overflow, increment address
inc GBASH
rle_yskip1:
lda (GBASL),y ; load value to write
iny
bne rle_yskip2
inc GBASH
rle_yskip2:
sty TEMP2 ; save y for later
pha
lda #$0
tay
pla ; convoluted way to set y to 0
rle_run_loop:
sta (BASL),y ; write out the value
inc BASL ; increment the pointer
bne rle_skip3 ; if wrapped
inc BASH ; then increment the high value
rle_skip3:
inx ; increment the X value
cpx CH ; compare against the image width
bcc rle_not_eol ; if less then keep going
pha ; save out value on stack
lda BASL ; cheat to avoid a 16-bit add
cmp #$a7 ; we are adding 0x58 to get
bcc rle_add_skip ; to the next line
inc BASH
rle_add_skip:
clc
adc #$58 ; actually do the 0x58 add
sta BASL ; and store it back
inc CV ; add 2 to ypos
inc CV ; each "line" is two high
lda CV ; load value
cmp #15 ; if it's greater than 14 it wraps
bcc rle_no_wrap ; Thanks Woz
lda #$0 ; we wrapped, so set to zero
sta CV
; when wrapping have to sub 0x3d8
sec ; this is a 16-bit subtract routine
lda BASL
sbc #$d8 ; LSB
sta BASL
lda BASH ; MSB
sbc #$3 ;
sta BASH
rle_no_wrap:
lda #$0 ; set X value back to zero
tax
pla ; restore value to write from stack
rle_not_eol:
dec RUN ; decrement run value
bne rle_run_loop ; if not zero, keep looping
ldy TEMP2 ; restore the input pointer
sec
bcs rle_loop ; and branch always
rle_done:
lda #$15 ; move the cursor somewhere sane
sta CV
rts
;==========================================================
; set_text_page0
;==========================================================
;
set_text_page0:
bit PAGE0 ; set page0
bit TEXT ; set text mode
rts
;==========================================================
; set_gr_page0
;==========================================================
@ -184,55 +76,6 @@ set_gr_page0:
bit SET_GR ; set graphics
rts
;=========================================================
; gr_copy_to_current
;=========================================================
; copy 0xc00 to DRAW_PAGE
; 2 + 8*38 + 4*80*23 + 4*120*26 + 13 = 20,159 = 20ms = 50Hz
;
gr_copy_to_current:
ldx #0 ; set y to zero ; 2
gr_copy_loop:
stx TEMP ; save y ; 3
txa ; move to A ; 2
asl ; mult by 2 ; 2
tay ; put into Y ; 2
lda gr_offsets,Y ; lookup low byte for line addr ; 5
sta OUTL ; out and in are the same ; 3
sta INL ; 3
lda gr_offsets+1,Y ; lookup high byte for line addr ; 5
adc DRAW_PAGE
sta OUTH ; 3
lda gr_offsets+1,Y ; lookup high byte for line addr ; 5
adc #$8 ; for now, fixed 0xc ; 2
sta INH ; 3
ldx TEMP ; restore y ; 3
ldy #0 ; set X counter to 0 ; 2
gr_copy_line:
lda (INL),Y ; load a byte ; 5
sta (OUTL),Y ; store a byte ; 6
iny ; increment pointer ; 2
cpx #$4 ; don't want to copy bottom 4*40 ; 2
bcs gr_copy_above4 ; 3
gr_copy_below4:
cpy #120 ; for early ones, copy 120 bytes ; 2
bne gr_copy_line ; 3
beq gr_copy_line_done ; 3
gr_copy_above4: ; for last four, just copy 80 bytes
cpy #80 ; 2
bne gr_copy_line ; 3
gr_copy_line_done:
inx ; increment y value ; 2
cpx #8 ; there are 8 of them ; 2
bne gr_copy_loop ; if not, loop ; 3
rts ; 6
;==========================================================
; Wait until keypressed
;==========================================================
@ -525,58 +368,6 @@ print_both_pages:
rts ; oops forgot this initially
; explains the weird vertical stripes on the screen
;=========================================
; vlin
;=========================================
; X, V2 at Y
vlin:
sty TEMPY ; save Y (x location)
vlin_loop:
txa ; a=x (get first y)
and #$fe ; Clear bottom bit
tay ;
lda gr_offsets,Y ; lookup low-res memory address low
sta GBASL ; put it into our indirect pointer
iny
lda gr_offsets,Y ; lookup low-res memory address high
clc
adc DRAW_PAGE ; add in draw page offset
sta GBASH ; put into top of indirect
ldy TEMPY ; load back in y (x offset)
txa ; load back in x (current y)
lsr ; check the low bit
bcc vlin_low ; if not set, skip to low
vlin_high:
lda #$F0 ; setup masks
sta MASK
lda #$0f
bcs vlin_too_slow
vlin_low: ; setup masks
lda #$0f
sta MASK
lda #$f0
vlin_too_slow:
and (GBASL),Y ; mask current byte
sta (GBASL),Y ; and store back
lda MASK ; mask the color
and COLOR
ora (GBASL),Y ; or into the right place
sta (GBASL),Y ; store it
inx ; increment X (current y)
cpx V2 ; compare to the limit
bcc vlin_loop ; if <= then loop
rts ; return
;================================
; hlin_setup

View File

@ -98,24 +98,6 @@ COLOR_MASK EQU $8B
SHIPY EQU $E4
;; World Map Only
ODD EQU $7B
DIRECTION EQU $7C
REFRESH EQU $7D
ON_BIRD EQU $7E
MOVED EQU $7F
STEPS EQU $80
TFV_X EQU $81
TFV_Y EQU $82
NEWX EQU $83
NEWY EQU $84
MAP_X EQU $85
GROUND_COLOR EQU $86
KEYPRESS EQU $C000
KEYRESET EQU $C010