Code: Select all
LDX #2047 ;plot 2048 random ASCII characters, during HSYNC, using HDL PRNG for Character Plot Function
rock LDA rng
STA color ;foreground color
LDA rng
STA bcolor ;background color
LDA rng
AND #%0000000000111111 ;[7:0] bits is ASCII value, only 96 characters available so mask off [5:0]
ORA #%0000000100000000 ;set bit [8] to 1 for C-64 font
STA Att
NG LDA rng ;get 16-bit sample from HDL pseudo random number generator
AND #%0000011111111111 ;mask off 11 bits
CMP #1920-8
BCS NG ;if random sample is >1911 get another random sample
STA cX
NG1 LDA rng
AND #%0000011111111111 ;mask off 11 bits
CMP #1080-8
BCS NG1 ;if random sample is >1071 get another sample
BCF0C $FFFFE ;Branch if Control Flag 0 is Clear (0). CF0 is HSYNC input, so branch to itself and wait until hsync = 1, a non display period
STA cY ;plot Character!
DEX
BNE rock
imp JMP imp