diff --git a/8bitunity.asm b/8bitunity.asm index de3395e..dbfe948 100644 --- a/8bitunity.asm +++ b/8bitunity.asm @@ -3,28 +3,37 @@ processor 6502 -kbd = $c000 -kbstrb = $c010 -speaker = $c030 +kbd equ $c000 +kbstrb equ $c010 +speaker equ $c030 + +graphics equ $c050 +text equ $c051 +fullpage equ $c052 +page1 equ $c054 +hires equ $c057 -graphx = $c050 -text = $c051 -page1 = $c054 -hires = $c057 org $803 - - - jsr clear_hgr1 - - sta graphx - sta text + + sta hires + sta fullpage + sta graphics + sta page1 -Start jmp Start +Start + jsr test_blitSHR_orig - include "8bitunity-plot_scroll.asm" + +end jmp end + + + include "blitSHR_orig.asm" include "hires.asm" + + org $2000 + incbin "marioluigi-apple2.hires.bin" \ No newline at end of file diff --git a/bin/8bitunity.asm.rom b/bin/8bitunity.asm.rom index ed5c8be..78656a4 100644 Binary files a/bin/8bitunity.asm.rom and b/bin/8bitunity.asm.rom differ diff --git a/blitSHR_orig.asm b/blitSHR_orig.asm new file mode 100644 index 0000000..2387fa1 --- /dev/null +++ b/blitSHR_orig.asm @@ -0,0 +1,159 @@ + + +hiresXZP equ $ec ; hires X offset (xcol) +hiresYZP equ $ed ; hires Y offset (yrow) +hiresAddrZP equ $fc ; 16 bit address of hires line (from LUT) +inputAddrZP equ $fa ; 16 bit input address (bitmap to draw) +outputAddrZP equ $ee ; 16 bit output address (buffer to save) +scr2outRowsZP equ $ce ; number of rows (output) (height) +inp2scrRowsZP equ $eb ; number of rows (input) (height) +bytesPerRowZP equ $e3 ; bytes per row (width) +toggleMainAuxZP equ $42 ; not used here + + +;; blitSHR original code + +blitSHR_orig subroutine + + ldx #0 +; Copy Screen Address from Hires Tables (using Line Offset Y and Byte Offset X) +.loopRow + ldy hiresYZP ; Y-Offset to Hires Line (ytop) + lda hiresLinesHI,y + sta hiresAddrZP+1 + + lda hiresLinesLO,y + adc hiresXZP ; X-Offset to Hires Byte (xcol) + sta hiresAddrZP + +; Copy bytes from SHR buffer to ouput +.screen2output + lda outputAddrZP+1 + beq .input2screen ; If high-byte is zero, then skip + ldy #0 ; Y loop: Copy xxx bytes per row +.loopCopy1 ; Copy 1 byte + lda (hiresAddrZP),y + sta (outputAddrZP),y + iny + cpy bytesPerRowZP + bne .loopCopy1 ; Iterate Y loop + +; Copy bytes from input to SHR buffer + cpx inp2scrRowsZP ; Check number of input rows (for cropped sprites) + bcs .incAddress1 +.input2screen + clc + lda inputAddrZP+1 + beq .incAddress1 ; If high-byte is zero, then skip + ldy #0 ; Y loop: Copy xxx bytes per row +.loopCopy2 + lda (inputAddrZP),y ; Copy 1 byte + sta (hiresAddrZP),y + iny + cpy bytesPerRowZP ; Iterate Y loop + bne .loopCopy2 + +.incAddress1 + clc ; Increment address of output block + lda outputAddrZP + adc bytesPerRowZP ; Move by xxx bytes + sta outputAddrZP + bcc .nocarry1 ; Check if carry to high-byte + inc outputAddrZP+1 +.nocarry1 + +.incAddress2 + clc ; Increment address of input block + lda inputAddrZP + adc bytesPerRowZP ; Move by xxx bytes + sta inputAddrZP + bcc .nocarry2 ; Check if carry to high byte + inc inputAddrZP+1 +.nocarry2 + +.nextRow + ; Move to next row + inc hiresYZP ; Increment Hires Line offset + inx + cpx scr2outRowsZP + bcc .loopRow ; Iterate X loop (rows) + + rts + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +test_blitSHR_orig subroutine + +xcol equ $06 +yrow equ $07 + + lda #0 + sta xcol + sta yrow + + lda #3 + sta bytesPerRowZP ; width + + lda #21 ; height + sta inp2scrRowsZP + sta scr2outRowsZP + + + clc ; needed because not in routine ! +.loop_mario_x + lda #buffer + sta outputAddrZP+1 + + lda #mario + sta inputAddrZP+1 + + lda xcol + sta hiresXZP + lda yrow + sta hiresYZP + + + jsr blitSHR_orig + + lda #buffer + sta inputAddrZP+1 + + lda #0 + sta outputAddrZP+1 + + lda xcol + sta hiresXZP + lda yrow + sta hiresYZP + + clc ; needed because not in routine ! + jsr blitSHR_orig + + + ldx xcol + inx + stx xcol + cpx #38 + bcc .loop_mario_x + + ldx #0 + stx xcol + ldx yrow + inx + stx yrow + cpx #191-21 + bcc .loop_mario_x + +.rts rts + + + + + \ No newline at end of file diff --git a/hires.asm b/hires.asm index 3279a6e..3753c2a 100644 --- a/hires.asm +++ b/hires.asm @@ -103,5 +103,28 @@ hiresLinesLO hex D0D0D0D0D0D0D0D0 - - +mario ; 3x21 + hex 80A880 + hex 80AA80 + hex C0AA85 + hex A09D80 + hex E88D87 + hex E8FF9F + hex A8FF80 + hex A8DF82 + hex 80FF81 + hex C09580 + hex A89681 + hex AA9683 + hex AB968B + hex A3AA8B + hex C7AAFB + hex C7AAFD + hex C0AA85 + hex D08285 + hex D08295 + hex A8808A + hex AA80AA + +buffer ; 3x21 + ds.b 63,00 \ No newline at end of file diff --git a/marioluigi-apple2.hires.bin b/marioluigi-apple2.hires.bin new file mode 100644 index 0000000..0ffa207 Binary files /dev/null and b/marioluigi-apple2.hires.bin differ