tiny little gizmos

HA – Ich kann es noch…

Über 20 Jahre ist es her, dass ich es zum letzten Mal getan habe, aber ich kann es noch. Einer kleine Fingerübung in 6502 Assembler. Memorymap und KickAss sei dank…

.pc =$0801

// 2011 SYS 2062
basicstart:    .byte 12, 8, 219, 7, 158, 32
               .byte 50, 48, 54, 50, 0, 0, 0

               lda #$00
               sta $d020 // Border black
               sta $d021 // Background black

// Address of screen($0400) in zeropage $03/$04
               lda #$00
               sta $03
               lda #$04
               sta $04

// Address of gamefield in Zeropage $05/$06
               lda #< Gamefield
               sta $05
               lda #> Gamefield
               sta $06

               ldx #$00
rowloop:       ldy #$00
colloop:       lda ($05),y
               sta ($03),y
               iny
               cpy #$0b
               bne colloop
// next row: add 32 to source and 40 to target
               clc
               lda $03
               adc #$28
               sta $03
               lda $04
               adc #$00
               sta $04
               clc
               lda $05
               adc #$20
               sta $05
               lda $06
               adc #$00
               sta $06

               inx
               cpx #$0b
               bne rowloop
               rts

Gamefield:
               .text "+---------+                +---+"
               .text "!         !     +-----+    !   !"
               .text "!         !     !     +----+   !"
               .text "!         !     !              !"
               .text "!         !     !     +----+   !"
               .text "!         !     +-----+    !   !"
               .text "!         +---+            ++ ++"
               .text "!             !             ! ! "
               .text "!         +-+ +-------------+ ! "
               .text "!         ! !                 ! "
               .text "+---------+ +-----------------+ "
               .text "01234567890123456789012345678901"