OSDN Git Service

modified input data latch to stop using latch, but use dff.
[motonesfpga/motonesfpga.git] / tools / test-image / sample1.asm
index 57bf476..68ed6ae 100644 (file)
 \r
 .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
        ldx     #$ff\r
@@ -62,44 +80,23 @@ copymap:
 ;;;;----------------------\r
     ;;load name tbl.\r
     ldy #$00\r
-    ldx #$2c\r
+    ldx #$40    ;;name table entry cnt.\r
 \r
     lda #$20\r
     sta $2006\r
-    lda #$80\r
+    lda #$c0\r
     sta $2006\r
 \r
-    lda #$80\r
-    sta $00\r
-    lda #$20\r
-    sta $01\r
-\r
 nt_st:\r
-    cpy #$0b\r
-    bne goto_next1\r
-    jsr add_nl\r
-    jmp goto_next3\r
-goto_next1:\r
-    cpy #$16\r
-    bne goto_next2\r
-    jsr add_nl\r
-    jmp goto_next3\r
-goto_next2:\r
-    cpy #$21\r
-    bne goto_next3\r
-    jsr add_nl\r
-goto_next3:\r
-\r
     lda nt1, y\r
     sta $2007\r
     iny\r
     dex\r
     bpl nt_st\r
 \r
-\r
     ;;load attr tbl.\r
     ldy #$00\r
-    ldx #$04\r
+    ldx #$08    ;;attribute entry cnt\r
 \r
     lda #$23\r
     sta $2006\r
@@ -114,18 +111,79 @@ at_st:
     bpl at_st\r
 \r
     ;;set universal bg color.\r
-    lda #$3f\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 #$10\r
+    lda #$c0\r
     sta $2006\r
-    lda #$3d\r
+\r
+nt2_st:\r
+    lda nt2, y\r
     sta $2007\r
+    iny\r
+    dex\r
+    bpl nt2_st\r
 \r
-    ;;set scroll reg.\r
-    lda #$03\r
-    sta $2005\r
-    lda #$00\r
-    sta $2005\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
+;;;    ;;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
@@ -158,6 +216,8 @@ read_status:
 \r
 \r
 nmi_test:\r
+    jsr set_scroll\r
+    jsr set_bg_col\r
 \r
     rti\r
 \r
@@ -187,14 +247,48 @@ no_carry:
     tax\r
     rts\r
 \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   $61, $62, $63, $64, $65, $66, $67, $68, $69, $6a, $6b\r
-       .byte   $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3a\r
-       .byte   $41, $42, $43, $44, $45, $46, $47, $48, $49, $4a, $4b\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
@@ -211,6 +305,12 @@ palettes:
 string:\r
        .byte   "test2!"\r
 \r
+;;;for DE1 internal memory constraints.\r
+.segment "VECINFO_4k"\r
+       .word   nmi_test\r
+       .word   Reset\r
+       .word   $0000\r
+\r
 .segment "VECINFO"\r
        .word   nmi_test\r
        .word   Reset\r