.segment "STARTUP"\r
.proc Reset\r
\r
+;;; de1 env decoder bug test\r
+;;;LDA $8182, y\r
+;;;STA $2007\r
+;;;INY \r
+;;;DEX \r
+;;;;;BPL #-10\r
+;;;LDA $8182, y\r
+;;;STA $2007\r
+;;;INY \r
+;;;DEX \r
+;;;;;BPL #-10\r
+;;;LDA #$3d\r
+;;;STA $0302 ;;;>>>invalid store address!!!! @ 907,921,200 ps\r
+\r
+\r
+\r
\r
; interrupt off, initialize sp.\r
sei\r
sta $2001\r
\r
\r
- ;;bg palette\r
lda #$3f\r
sta $2006\r
lda #$00\r
sta $2006\r
\r
- lda #$11\r
- sta $2007\r
- lda #$01\r
- sta $2007\r
- lda #$03\r
- sta $2007\r
- lda #$13\r
- sta $2007\r
-\r
- lda #$0f\r
- sta $2007\r
- lda #$04\r
- sta $2007\r
- lda #$14\r
- sta $2007\r
- lda #$24\r
- sta $2007\r
-\r
- lda #$0f\r
- sta $2007\r
- lda #$08\r
- sta $2007\r
- lda #$18\r
- sta $2007\r
- lda #$28\r
- sta $2007\r
-\r
- lda #$05\r
- sta $2007\r
- lda #$0c\r
- sta $2007\r
- lda #$1c\r
- sta $2007\r
- lda #$2c\r
- sta $2007\r
-\r
- ;;sprite..\r
- lda #$00\r
- sta $2007\r
- lda #$24\r
- sta $2007\r
- lda #$1b\r
- sta $2007\r
- lda #$11\r
- sta $2007\r
-\r
- lda #$00\r
- sta $2007\r
- lda #$32\r
- sta $2007\r
- lda #$16\r
+ ;;load palette.\r
+ ldx #$00\r
+ ldy #$20\r
+copypal:\r
+ lda palettes, x\r
sta $2007\r
- lda #$20\r
- sta $2007\r
-\r
- lda #$00\r
- sta $2007\r
- lda #$26\r
- sta $2007\r
- lda #$01\r
- sta $2007\r
- lda #$31\r
- sta $2007\r
-\r
-\r
+ inx\r
+ dey\r
+ bne copypal\r
\r
- ;;name table set.\r
lda #$20\r
sta $2006\r
- lda #$06\r
+ lda #$ab\r
sta $2006\r
+ ldx #$00\r
+ ldy #$0d\r
\r
-;;0x44, 45, 45 = DEE\r
- lda #$44\r
+ ;;load name table.\r
+copymap:\r
+ lda string, x\r
sta $2007\r
- lda #$45\r
- sta $2007\r
- lda #$45\r
- sta $2007\r
-\r
+ inx\r
+ dey\r
+ bne copymap\r
\r
- lda #$20\r
- sta $2006\r
- lda #$60\r
- sta $2006\r
-\r
- lda #48\r
- sta $2007\r
- lda #49\r
- sta $2007\r
- lda #50\r
- sta $2007\r
- lda #51\r
- sta $2007\r
- lda #52\r
- sta $2007\r
- lda #53\r
- sta $2007\r
- lda #54\r
- sta $2007\r
- lda #55\r
- sta $2007\r
- lda #56\r
+ ;;scroll reg set.\r
+ lda #$00\r
+ sta $2005\r
+ sta $2005\r
\r
+;;;;----------------------\r
+ ;;load name tbl.\r
+ ldy #$00\r
+ ldx #$40 ;;name table entry cnt.\r
\r
+ lda #$20\r
+ sta $2006\r
+ lda #$c0\r
+ sta $2006\r
\r
- lda #$21\r
- sta $2006\r
- lda #$e6\r
- sta $2006\r
+nt_st:\r
+ lda nt1, y\r
+ sta $2007\r
+ iny\r
+ dex\r
+ bpl nt_st\r
\r
-;;test pattern\r
- lda #$20\r
- sta $2006\r
- lda #$20\r
- sta $2006\r
+ ;;load attr tbl.\r
+ ldy #$00\r
+ ldx #$08 ;;attribute entry cnt\r
\r
- lda #$01\r
- sta $2007\r
- lda #$02\r
- sta $2007\r
- lda #$03\r
- sta $2007\r
- lda #$04\r
- sta $2007\r
- lda #$05\r
- sta $2007\r
- lda #$06\r
- sta $2007\r
- lda #$07\r
- sta $2007\r
- lda #$08\r
- sta $2007\r
- lda #$09\r
- sta $2007\r
- lda #$0a\r
- sta $2007\r
- lda #$0b\r
- sta $2007\r
- lda #$0c\r
- sta $2007\r
- lda #$0d\r
- sta $2007\r
- lda #$0e\r
- sta $2007\r
- lda #$0f\r
- sta $2007\r
+ lda #$23\r
+ sta $2006\r
+ lda #$c8\r
+ sta $2006\r
\r
- lda #$20\r
- sta $2006\r
- lda #$40\r
- sta $2006\r
+at_st:\r
+ lda at1, y\r
+ sta $2007\r
+ iny\r
+ dex\r
+ bpl at_st\r
\r
- lda #$10\r
- sta $2007\r
- lda #$11\r
- sta $2007\r
- lda #$12\r
- sta $2007\r
- lda #$13\r
- sta $2007\r
- lda #$14\r
- sta $2007\r
- lda #$15\r
- sta $2007\r
- lda #$16\r
- sta $2007\r
- lda #$17\r
- sta $2007\r
- lda #$18\r
- sta $2007\r
- lda #$19\r
- sta $2007\r
- lda #$1a\r
- sta $2007\r
- lda #$1b\r
- sta $2007\r
- lda #$1c\r
- sta $2007\r
- lda #$1d\r
- sta $2007\r
- lda #$1e\r
- sta $2007\r
- lda #$1f\r
- sta $2007\r
+ ;;set universal bg color.\r
+ lda #$3d\r
+ sta $0302\r
+ jsr set_bg_col\r
+\r
+ ;;set scroll reg.\r
+ ;;lda #$a6\r
+ lda #$05\r
+ sta $0300\r
+ lda #00\r
+ sta $0301\r
+ jsr set_scroll\r
+\r
+ ;;set next page name table\r
+ ldy #$00\r
+ ldx #$0b\r
\r
+ lda #$24\r
+ sta $2006\r
+ lda #$c0\r
+ sta $2006\r
\r
-;;attr\r
- lda #$23\r
- sta $2006\r
- lda #$c1\r
- sta $2006\r
+nt2_st:\r
+ lda nt2, y\r
+ sta $2007\r
+ iny\r
+ dex\r
+ bpl nt2_st\r
\r
-;;--attr=11011000\r
- lda #$d8\r
- sta $2007\r
+ ;;next page attr.\r
+ lda #$27\r
+ sta $2006\r
+ lda #$d0\r
+ sta $2006\r
\r
+ lda #$e4\r
+ sta $2007\r
\r
+;;---------------------\r
;;;set sprite\r
;;sprite addr=00\r
lda #$00\r
sta $2003\r
-\r
- ;;sprite data: y=02\r
- lda #3\r
+ ;;sprite data: y=60\r
+ lda #$3c\r
sta $2004\r
;;tile=0x4d (ascii 'M')\r
lda #$4d\r
sta $2004\r
- lda #$01\r
- sta $2004\r
- ;x=100\r
- lda #$64\r
- sta $2004\r
-\r
- lda #$32\r
- sta $2004\r
- lda #$4f\r
- sta $2004\r
- lda #$01\r
- sta $2004\r
- lda #$1e\r
- sta $2004\r
-\r
- lda #60\r
- sta $2004\r
- lda #$50\r
- sta $2004\r
- lda #$01\r
- sta $2004\r
- lda #$21\r
- sta $2004\r
-\r
-\r
- lda #$3d\r
- sta $2004\r
- lda #$51\r
- sta $2004\r
- lda #$02\r
+ lda #$00\r
sta $2004\r
- lda #45\r
+ ;x=39\r
+ lda #$27\r
sta $2004\r
\r
- ;;dma test data.\r
- ldy #$00\r
- ldx #$41\r
- stx $00\r
- ldx #$00\r
-dma_set:\r
- ;;y pos\r
- txa\r
- sta $0200, y\r
- iny\r
- ;;tile index\r
- lda $00\r
- cmp #$5b\r
- bne inc_tile\r
- lda #$41\r
- sta $00\r
-inc_tile:\r
- inc $00\r
- sta $0200, y\r
- iny\r
- ;;attribute\r
- lda #$01\r
- sta $0200, y\r
- iny\r
- ;;x pos\r
- txa\r
- adc #$03\r
- tax\r
- rol\r
- sta $0200, y\r
- iny\r
- bne dma_set\r
-\r
- ;;dma start.\r
- lda #$02\r
- sta $4014\r
-\r
-\r
-\r
- ;;init scroll point.\r
- lda #$00\r
- sta $2005\r
- lda #248\r
- sta $2005\r
+;;; ;;dma test data.\r
+;;; ldy #$00\r
+;;; ldx #$41\r
+;;; stx $00\r
+;;; ldx #$00\r
+;;;dma_set:\r
+;;; ;;y pos\r
+;;; txa\r
+;;; sta $0200, y\r
+;;; iny\r
+;;; ;;tile index\r
+;;; lda $00\r
+;;; cmp #$5b\r
+;;; bne inc_tile\r
+;;; lda #$41\r
+;;; sta $00\r
+;;;inc_tile:\r
+;;; inc $00\r
+;;; sta $0200, y\r
+;;; iny\r
+;;; ;;attribute\r
+;;; lda #$01\r
+;;; sta $0200, y\r
+;;; iny\r
+;;; ;;x pos\r
+;;; txa\r
+;;; adc #$03\r
+;;; tax\r
+;;; rol\r
+;;; sta $0200, y\r
+;;; iny\r
+;;; bne dma_set\r
+;;;\r
+;;; ;;dma start.\r
+;;; lda #$02\r
+;;; sta $4014\r
\r
;;show bg...\r
lda #$1e\r
;;done...\r
;;infinite loop.\r
mainloop:\r
+\r
+ ;;read ppu status reg while displaying\r
+ ;;vram read test\r
+ ldx #$0a\r
+l1:\r
+ nop\r
+ dex\r
+ bne l1\r
+\r
+ ldx #$0a\r
+read_status:\r
+ lda $2002\r
+ dex\r
+ bne read_status\r
+\r
jmp mainloop\r
.endproc\r
\r
\r
nmi_test:\r
-; jsr set_scroll\r
-; jsr set_bg_col\r
- jsr set_dma\r
+ jsr set_scroll\r
+ jsr set_bg_col\r
\r
rti\r
\r
-set_dma:\r
- ldy #0\r
+add_nl:\r
+ clc\r
+ txa\r
+ pha\r
\r
-y_loop:\r
- lda $0200, y\r
+ lda $01\r
+ sta $2006\r
\r
- clc\r
- adc #$1\r
- sta $0200, y\r
+ lda $00\r
+ adc #$20\r
+ sta $00\r
+ sta $2006\r
\r
- iny\r
- iny\r
- iny\r
- iny\r
+ bcc no_carry\r
+ lda $01\r
+ adc #$00\r
+ sta $01\r
+ sta $2006\r
+ lda $00\r
+ sta $2006\r
+no_carry:\r
\r
- bne y_loop\r
+ pla\r
+ tax\r
+ rts\r
\r
- ;;dma start.\r
- lda #$02\r
- sta $4014\r
+set_scroll:\r
+ lda $0300\r
+ sta $2005\r
+ clc\r
+ adc #$05\r
+ sta $0300\r
+ lda $0301\r
+ sta $2005\r
+ clc\r
+ adc #04\r
+;; sta $0301\r
+ rts\r
\r
+set_bg_col:\r
+ lda #$3f\r
+ sta $2006\r
+ lda #$10\r
+ sta $2006\r
+ lda $0302\r
+ sta $2007\r
+ cmp #$30\r
+ bne bg_dec\r
+ lda #$3d\r
+ sta $0302\r
+ jmp bg_done\r
+bg_dec:\r
+ dec $0302\r
+bg_done:\r
rts\r
\r
+nt1:\r
+ .byte $41, $42, $43, $44, $45, $46, $47, $48, $49, $4a, $4b, $4c, $4d, $4e, $4f, $50\r
+ .byte $61, $62, $63, $64, $65, $66, $67, $68, $69, $6a, $6b, $6c, $6d, $6e, $6f, $70\r
+ .byte $80, $81, $82, $83, $84, $85, $86, $87, $88, $89, $8a, $8b, $8c, $8d, $8e, $8f\r
+ .byte $90, $91, $92, $93, $94, $95, $96, $97, $98, $99, $9a, $9b, $9c, $9d, $9e, $9f\r
+nt2:\r
+ .byte $6b, $6a, $69, $68, $67, $66, $65, $64, $63, $62, $61\r
+ .byte $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3a\r
+\r
+at1:\r
+ .byte $1b, $e4, $a5, $5a\r
+ .byte $e4, $1b, $5a, $a5\r
+\r
+palettes:\r
+;;;bg palette\r
+ .byte $0f, $00, $10, $20\r
+ .byte $0f, $04, $14, $24\r
+ .byte $0f, $08, $18, $28\r
+ .byte $0f, $0c, $1c, $2c\r
+;;;spr palette\r
+ .byte $0f, $00, $10, $20\r
+ .byte $0f, $06, $16, $26\r
+ .byte $0f, $08, $18, $28\r
+ .byte $0f, $0a, $1a, $2a\r
+\r
+string:\r
+ .byte "test2!"\r
\r
;;;for DE1 internal memory constraints.\r
.segment "VECINFO_4k"\r