2014-04-02 16:48:44 +00:00
|
|
|
assign byte table screen $0400
|
2014-04-02 13:24:43 +00:00
|
|
|
assign byte table screen2 1274
|
|
|
|
assign byte table screen3 1524
|
|
|
|
assign byte table screen4 1774
|
|
|
|
|
|
|
|
assign byte table colormap 55296
|
|
|
|
assign byte table colormap2 55546
|
|
|
|
assign byte table colormap3 55796
|
|
|
|
assign byte table colormap4 56046
|
|
|
|
|
|
|
|
assign byte vic_border 53280
|
|
|
|
assign byte table vic_bg 53281
|
|
|
|
|
|
|
|
assign vector cinv 788
|
|
|
|
reserve vector save_cinv
|
|
|
|
|
2014-04-02 16:48:44 +00:00
|
|
|
; TODO: this should be a word
|
|
|
|
|
|
|
|
assign byte pos_lo $fb
|
|
|
|
assign byte pos_hi $fc
|
|
|
|
|
|
|
|
reserve byte value
|
|
|
|
|
|
|
|
reserve byte m_hi
|
|
|
|
reserve byte m_lo
|
|
|
|
reserve byte n_hi
|
|
|
|
reserve byte n_lo
|
|
|
|
|
2014-04-02 13:24:43 +00:00
|
|
|
routine main {
|
|
|
|
lda #5
|
|
|
|
sta vic_border
|
|
|
|
lda #0
|
|
|
|
sta vic_bg
|
2014-04-02 16:48:44 +00:00
|
|
|
jsr reset_pos
|
2014-04-02 13:24:43 +00:00
|
|
|
jsr clear_screen
|
|
|
|
sei {
|
|
|
|
copy vector cinv to save_cinv
|
|
|
|
copy routine our_cinv to cinv
|
|
|
|
}
|
|
|
|
clc
|
|
|
|
repeat bcc { }
|
|
|
|
}
|
|
|
|
|
2014-04-02 16:48:44 +00:00
|
|
|
routine reset_pos {
|
|
|
|
lda #$00
|
|
|
|
sta pos_lo
|
|
|
|
lda #$04
|
|
|
|
sta pos_hi
|
|
|
|
}
|
|
|
|
|
2014-04-02 13:24:43 +00:00
|
|
|
routine our_cinv {
|
2014-04-02 16:48:44 +00:00
|
|
|
lda value
|
|
|
|
inc value
|
|
|
|
ldy #0
|
|
|
|
sta (pos_lo), y
|
|
|
|
jsr increment_pos
|
|
|
|
jsr compare_pos
|
|
|
|
if beq {
|
|
|
|
jsr reset_pos
|
|
|
|
} else {
|
|
|
|
}
|
2014-04-02 13:24:43 +00:00
|
|
|
jmp save_cinv
|
|
|
|
}
|
|
|
|
|
2014-04-02 16:48:44 +00:00
|
|
|
routine increment_pos {
|
|
|
|
clc
|
|
|
|
lda pos_lo
|
|
|
|
adc #1
|
|
|
|
sta pos_lo
|
|
|
|
lda pos_hi
|
|
|
|
adc #0
|
|
|
|
sta pos_hi
|
|
|
|
}
|
|
|
|
|
|
|
|
routine compare_pos {
|
|
|
|
lda pos_lo
|
|
|
|
sta m_lo
|
|
|
|
lda pos_hi
|
|
|
|
sta m_hi
|
|
|
|
lda #$07
|
|
|
|
sta n_hi
|
|
|
|
lda #$e8
|
|
|
|
sta n_lo
|
|
|
|
jsr compare_16_bit
|
|
|
|
}
|
|
|
|
|
|
|
|
routine compare_16_bit {
|
|
|
|
lda m_hi
|
|
|
|
cmp n_hi
|
|
|
|
if beq {
|
|
|
|
lda m_lo
|
|
|
|
cmp n_lo
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-02 13:24:43 +00:00
|
|
|
routine clear_screen {
|
|
|
|
ldy #0
|
|
|
|
repeat bne {
|
|
|
|
lda #1
|
|
|
|
sta colormap, y
|
|
|
|
sta colormap2, y
|
|
|
|
sta colormap3, y
|
|
|
|
sta colormap4, y
|
|
|
|
|
|
|
|
lda #32
|
|
|
|
sta screen, y
|
|
|
|
sta screen2, y
|
|
|
|
sta screen3, y
|
|
|
|
sta screen4, y
|
|
|
|
|
|
|
|
iny
|
|
|
|
cpy #250
|
|
|
|
}
|
|
|
|
}
|