2022-12-04 00:00:17 +00:00
|
|
|
processor 6502
|
|
|
|
|
2022-12-04 17:06:59 +00:00
|
|
|
srcPointer = $b5
|
|
|
|
dstPointer = $b7
|
|
|
|
dstPointerEnd = $b9
|
|
|
|
fake_current_byte = $126
|
|
|
|
count = $128
|
|
|
|
|
2022-12-04 00:00:17 +00:00
|
|
|
org $a000
|
|
|
|
|
2022-12-04 17:06:59 +00:00
|
|
|
WORD coldstart
|
|
|
|
WORD warmstart
|
2022-12-04 00:00:17 +00:00
|
|
|
BYTE #$41, #$30, #$c3, #$c2, #$cd
|
|
|
|
|
2022-12-04 17:06:59 +00:00
|
|
|
coldstart SUBROUTINE
|
2022-12-04 00:00:17 +00:00
|
|
|
cld
|
|
|
|
sei
|
2022-12-04 17:06:59 +00:00
|
|
|
|
|
|
|
jsr $fd8d ; initialize and test RAM
|
|
|
|
jsr $fd52 ; restore default I/O vectors
|
|
|
|
jsr $fdf9 ; initialize I/O registers
|
|
|
|
jsr $e518 ; initialize hardware
|
|
|
|
cli ; enable interrupts
|
|
|
|
|
2022-12-04 00:00:17 +00:00
|
|
|
lda $0288
|
|
|
|
sta $0294
|
2022-12-04 17:06:59 +00:00
|
|
|
|
|
|
|
jsr $e45b ; initialize BASIC vector table
|
|
|
|
jsr $e3a4 ; initialize BASIC RAM locations
|
|
|
|
jsr $e404 ; print startup message and initialize memory pointers
|
|
|
|
ldx #$fb ; value for stack start
|
|
|
|
txs ; set stack pointer
|
2022-12-04 17:54:40 +00:00
|
|
|
lda #$76 ; set "READY." pointer
|
|
|
|
ldy #$c3
|
|
|
|
jsr $cb1e ; print null terminated string
|
2022-12-04 17:06:59 +00:00
|
|
|
lda #$80 ; set for control messages only
|
|
|
|
jsr $ff90 ; control kernal messages
|
|
|
|
|
|
|
|
.oracopio:
|
|
|
|
jsr copycode
|
|
|
|
.almost_ready:
|
|
|
|
|
2022-12-04 17:54:40 +00:00
|
|
|
; set current BASIC line number
|
|
|
|
lda #$ff
|
|
|
|
sta $3a
|
|
|
|
lda #0
|
|
|
|
sta $3b
|
|
|
|
|
|
|
|
; set start of variables
|
|
|
|
lda #$ff
|
|
|
|
sta $2d
|
|
|
|
lda #$15
|
|
|
|
sta $2e
|
2022-12-04 17:06:59 +00:00
|
|
|
|
|
|
|
; setup fake chrin
|
|
|
|
; sei
|
|
|
|
; lda #0
|
|
|
|
; sta fake_current_byte
|
|
|
|
; lda #<fake_chrin
|
|
|
|
; sta $324
|
|
|
|
; lda #>fake_chrin
|
|
|
|
; sta $325
|
|
|
|
; cli
|
|
|
|
|
|
|
|
jmp $c483 ; BASIC
|
|
|
|
|
|
|
|
fake_input_line:
|
|
|
|
BYTE "RUN", #$0d
|
|
|
|
|
|
|
|
fake_chrin SUBROUTINE
|
|
|
|
ldy fake_current_byte
|
|
|
|
lda fake_input_line,y
|
|
|
|
iny
|
|
|
|
sty fake_current_byte
|
|
|
|
cpy #4
|
|
|
|
bne .end_fake_chrin
|
|
|
|
sei
|
|
|
|
lda #$f2
|
|
|
|
sta $324
|
|
|
|
lda #$0e
|
|
|
|
sta $325
|
2022-12-04 00:00:17 +00:00
|
|
|
cli
|
2022-12-04 17:06:59 +00:00
|
|
|
.end_fake_chrin:
|
|
|
|
clc
|
|
|
|
rts
|
|
|
|
|
|
|
|
; jsr $e3a4 ; initialize BASIC RAM locations
|
|
|
|
|
|
|
|
; ldx #$00 ; BASIC execute pointer
|
|
|
|
; ldy #$10
|
|
|
|
; stx $7a
|
|
|
|
; sty $7b
|
|
|
|
; save to 7a !!!!!!
|
|
|
|
|
|
|
|
; BASIC "RUN"
|
|
|
|
; lda #$8a
|
|
|
|
; sta $200
|
|
|
|
; lda #$0
|
|
|
|
; sta $201
|
|
|
|
; lda #$8a
|
|
|
|
; jmp $c7ed
|
2022-12-04 00:00:17 +00:00
|
|
|
|
2022-12-04 17:06:59 +00:00
|
|
|
|
|
|
|
warmstart SUBROUTINE
|
2022-12-04 00:00:17 +00:00
|
|
|
lda #$02
|
|
|
|
ldx #$00
|
|
|
|
clear_color_ram:
|
|
|
|
sta $9400,x
|
|
|
|
sta $9500,x
|
|
|
|
sta $9600,x
|
|
|
|
sta $9700,x
|
|
|
|
dex
|
|
|
|
bne clear_color_ram
|
|
|
|
|
|
|
|
ldx #$00
|
|
|
|
print:
|
|
|
|
lda message,x
|
2022-12-04 17:06:59 +00:00
|
|
|
beq infine_loop
|
2022-12-04 00:00:17 +00:00
|
|
|
sec
|
|
|
|
sbc #$40
|
|
|
|
sta 7724,x
|
|
|
|
sta 7746,x
|
|
|
|
sta 7768,x
|
|
|
|
sta 7790,x
|
|
|
|
inx
|
|
|
|
jmp print
|
|
|
|
|
2022-12-04 17:06:59 +00:00
|
|
|
infine_loop:
|
2022-12-04 00:00:17 +00:00
|
|
|
ldx #$00
|
|
|
|
loop:
|
|
|
|
stx 7680
|
|
|
|
dex
|
|
|
|
bne loop
|
2022-12-04 17:06:59 +00:00
|
|
|
jmp infine_loop
|
|
|
|
|
|
|
|
|
|
|
|
copycode SUBROUTINE
|
|
|
|
sei
|
|
|
|
lda #0
|
|
|
|
sta count
|
|
|
|
sta count + 1
|
|
|
|
|
|
|
|
lda #<basicdemo
|
|
|
|
sta srcPointer
|
|
|
|
lda #>basicdemo
|
|
|
|
sta srcPointer + 1
|
2022-12-04 00:00:17 +00:00
|
|
|
|
2022-12-04 17:06:59 +00:00
|
|
|
lda #$01
|
|
|
|
sta dstPointer
|
|
|
|
lda #$10
|
|
|
|
sta dstPointer + 1
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
copyloop:
|
|
|
|
lda (srcPointer),y
|
|
|
|
sta (dstPointer),y
|
|
|
|
inc srcPointer
|
|
|
|
bne .noinc1
|
|
|
|
inc srcPointer + 1
|
|
|
|
.noinc1:
|
|
|
|
inc dstPointer
|
|
|
|
bne .noinc2
|
|
|
|
inc dstPointer + 1
|
|
|
|
.noinc2:
|
|
|
|
|
|
|
|
inc count
|
|
|
|
bne .noinc3
|
|
|
|
inc count + 1
|
|
|
|
.noinc3:
|
|
|
|
|
|
|
|
; LENGTH
|
|
|
|
lda count
|
|
|
|
cmp #$00
|
|
|
|
bne copyloop
|
|
|
|
lda count + 1
|
|
|
|
cmp #$06
|
|
|
|
bne copyloop
|
|
|
|
|
|
|
|
cli
|
|
|
|
.finito:
|
|
|
|
rts
|
|
|
|
|
|
|
|
; lda srcPointer
|
|
|
|
; cmp #<demoend
|
|
|
|
; bne copyloop
|
|
|
|
; lda srcPointer + 1
|
|
|
|
; cmp #>demoend
|
|
|
|
;.remainder:
|
|
|
|
; bne copyloop
|
|
|
|
; rts
|
2022-12-04 00:00:17 +00:00
|
|
|
|
|
|
|
message:
|
|
|
|
BYTE "CIAO DEVELER BY GIOMBA",#$0
|
|
|
|
|
2022-12-04 17:06:59 +00:00
|
|
|
basicdemo:
|
|
|
|
.incbin "res/stillenacht.raw"
|
|
|
|
demoend:
|
|
|
|
|
2022-12-04 00:00:17 +00:00
|
|
|
. = $bfff
|
|
|
|
BYTE #$ff
|