summaryrefslogtreecommitdiff
path: root/flag.s
blob: 7865facc325d279fa18d6c3356a28e73c2191ad0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
;;; This thing is licensed under Creative Commons Zero v1.0 Universal, which essentially means
;;; "Public Domain".  (You can do anything you want without asking for permission.)
;;;
;;; SPDX-License-Identifier: CC0-1.0
;;;
;;; To compile (You can get cl65 from <https://cc65.github.io/>)
;;; $ cl65 -t c64 -C c64-asm.cfg -o flag.prg flag.s
;;;
;;; To run (You can get x64sc from <https://vice-emu.sourceforge.io/index.html>)
;;; $ x64sc -autostart flag.prg
;;;
;;; I am not an expert with actual hardware C64, but this should be capable of running on one.  I am
;;; of course not to be held responsible for any actual hardware damage.

    .export __LOADADDR__: absolute = 1
    .export __EXEHDR__: absolute = 1

.segment "LOADADDR"
    .word $0801
    .org $0801

.segment "EXEHDR"
    ;; 1312 SYS<main>
    .addr EmptyBasLine
    .word 1312
    .byte $9E
    .byte _start / 1000 .mod 10 + '0'
    .byte _start / 100  .mod 10 + '0'
    .byte _start / 10   .mod 10 + '0'
    .byte _start        .mod 10 + '0'
    .byte 0
EmptyBasLine:
    .word 0

.code
_start:
    lda #$00  ; Set border colour to black
    sta $d020

    lda #$03  ; Set text background to cyan
    sta $d021 ; This lets us not draw the top&bottom bars :)

    jsr $e544 ; Call the KERNAL internal clear screen routine
              ; See <http://unusedino.de/ec64/technical/aay/c64/rome544.htm>

    ldx #200
loop:
    ;; Full block character to each of the three bar text memory
    lda #$e0
    sta $400+5*40-1,x
    sta $400+10*40-1,x
    sta $400+15*40-1,x

    ;; Pinkish colour to mid-top & mid-bot bar colour memory
    lda #10
    sta $d800+5*40-1,x
    sta $d800+15*40-1,x

    ;; Ditto for white in the middle bar
    lda #1
    sta $d800+10*40-1,x

    dex
    bne loop

halt:
    ;; Busy spinloop :(
    jmp halt