процедурное 128б на C64

 

Очередная попытка слепить нечто, сократить до 64б не удалось

!to "vader.prg", cbm ; #name of output, type of assembly
!cpu 6502 ; type of cpu
* = $0801 ; set assembler context, where to operate.
          !word nxt_line    ; Calculate pointer to next BASIC line
          !word 2012        ; BASIC Line# (change this to any # you want)
          !byte $9e           ; BASIC token for SYS
;       if ml_start         ; If ml_start not defined, skip it for now
;          dc.b [ml_start]d ; ML start address (use any address here) 2061
!byte $32,$30,$36,$31
;       endif
          !byte 0;hex 00           ; End of BASIC line
nxt_line  !byte 0,0 ; hex 00 00        ; The next BASIC line would start here
ml_start
seed = 4
;Let’s modify this value to display bitmap at $2000-$3FFF :
;POKE 53272,PEEK(53272)OR8 : POKE 53265,PEEK(53265)OR32
;screen RAM at $0400-$07FF (1024-2047)
sei
lda 53272;D018
ora #8
sta 53272

lda 53265;D011,enable bitmap mode
ora #32
sta 53265
lda $a2 ; counter
sta seed
;init vars
iv
lda #25
sta $FE
lda #0
sta $FA
sta $FC
lda #4
sta $FD;(fc,fd)-color
lda #$20
sta $FB;(fa,fb) - bitmap
rlp:
ldy #40
vlp:
jsr rnd
and #$0F
;reverse byte
ldx #8
sta 2
sta 3
rbl:
    asl $02
    ror
    dex
    bne rbl
    ora 3
    sta ($FA,x)
jsr incfax
ldx #2
;eor $0F
and #$F0
    sta ($FA,x)
lda $FA
and #7
bne vlp
jsr incfax
dey;iny
;cpy #40
bne vlp
dec $FE
bne rlp
beq iv
incfax
inc $FA,x
bne exir
inc $FB,x
exir
rts
rnd: ;https://codebase64.org/doku.php?id=base:small_fast_8-bit_prng
        lda seed
        asl
        bcc noEor
        eor #$1d
noEor:  sta seed
rts


Комментарии