Again, this is designed for the Easy6502 virtual machine:
http://skilldrick.github.io/easy6502/
Code: Select all
;Initialize Starting Values
LDX #$08 ;Setting starting low byte
STX $01
LDX #$03 ;Setting Starting high byte
STX $02
LDX #$08 ;Setting draw limit
push: ;Starting Push Loop
LDA #$01 ;Setting pixel color
STA ($01),y ;Draw Pixel
TYA ;Transfer Offset to A
PHA ;Push A to Stack
INY ;Increment Offset in Y
CMP #$0f ;Check if Offset = 16
BNE push ;If not, loop again
CLC ;If Offset = 16, ClearCcarry
LDA $01 ;Then, Add vertical offset of 32 to Low Byte
ADC #$20
STA $01
pull: ;Starting Pull Loop
PLA ;Popping Offset Value from Stack
TAY ;Transfer Offset from A to Y
LDA #$01 ;Resetting Pixel Color
STA ($01),y ;Draw Pixel
CPY #$00 ;Check if more Offset Values in Stack
BNE pull ;If not, loop again
CLC ;If Stack is Empty, Clear Carry
LDA $01 ;Then, Add vertical offset of 32 to Low Byte
ADC #$20
STA $01
BCC cdown ;Check if Carry Set
;If not, Skip incrementing high byte
INC $02 ;Increment High Byte
cdown: ;Decrement Draw Limit Count
DEX
BNE push ;If Draw Limit = 0, End
;Else, Return to Push Loop
BRK ;End