Load BASIC program in memory, but does not start :-(
This commit is contained in:
parent
f58f40aa3f
commit
313b5a20ab
2
res/basicstart.asc
Normal file
2
res/basicstart.asc
Normal file
@ -0,0 +1,2 @@
|
||||
07 10 01 00 8a 00 00 00
|
||||
|
BIN
res/basicstart.bin
Normal file
BIN
res/basicstart.bin
Normal file
Binary file not shown.
BIN
res/data.raw
Normal file
BIN
res/data.raw
Normal file
Binary file not shown.
BIN
res/stillenacht.raw
Normal file
BIN
res/stillenacht.raw
Normal file
Binary file not shown.
160
src/main.asm
160
src/main.asm
@ -1,27 +1,93 @@
|
||||
processor 6502
|
||||
|
||||
srcPointer = $b5
|
||||
dstPointer = $b7
|
||||
dstPointerEnd = $b9
|
||||
fake_current_byte = $126
|
||||
count = $128
|
||||
|
||||
org $a000
|
||||
|
||||
WORD .coldstart
|
||||
WORD .warmstart
|
||||
WORD coldstart
|
||||
WORD warmstart
|
||||
BYTE #$41, #$30, #$c3, #$c2, #$cd
|
||||
|
||||
.coldstart:
|
||||
coldstart SUBROUTINE
|
||||
cld
|
||||
sei
|
||||
;jmp .coldstart
|
||||
jsr $fd8d
|
||||
jsr $fd52
|
||||
jsr $fdf9
|
||||
jsr $e518
|
||||
|
||||
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
|
||||
|
||||
lda $0288
|
||||
sta $0294
|
||||
jsr $e45b
|
||||
jsr $e3a4
|
||||
jsr $e404
|
||||
cli
|
||||
|
||||
.warmstart:
|
||||
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
|
||||
lda #$80 ; set for control messages only
|
||||
jsr $ff90 ; control kernal messages
|
||||
|
||||
.oracopio:
|
||||
jsr copycode
|
||||
.almost_ready:
|
||||
|
||||
|
||||
; 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
|
||||
cli
|
||||
.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
|
||||
|
||||
|
||||
warmstart SUBROUTINE
|
||||
lda #$02
|
||||
ldx #$00
|
||||
clear_color_ram:
|
||||
@ -35,7 +101,7 @@ clear_color_ram:
|
||||
ldx #$00
|
||||
print:
|
||||
lda message,x
|
||||
beq .end
|
||||
beq infine_loop
|
||||
sec
|
||||
sbc #$40
|
||||
sta 7724,x
|
||||
@ -45,20 +111,76 @@ print:
|
||||
inx
|
||||
jmp print
|
||||
|
||||
.end:
|
||||
|
||||
|
||||
restart:
|
||||
infine_loop:
|
||||
ldx #$00
|
||||
loop:
|
||||
stx 7680
|
||||
dex
|
||||
bne loop
|
||||
jmp restart
|
||||
jmp infine_loop
|
||||
|
||||
|
||||
copycode SUBROUTINE
|
||||
sei
|
||||
lda #0
|
||||
sta count
|
||||
sta count + 1
|
||||
|
||||
lda #<basicdemo
|
||||
sta srcPointer
|
||||
lda #>basicdemo
|
||||
sta srcPointer + 1
|
||||
|
||||
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
|
||||
|
||||
message:
|
||||
BYTE "CIAO DEVELER BY GIOMBA",#$0
|
||||
|
||||
basicdemo:
|
||||
.incbin "res/stillenacht.raw"
|
||||
demoend:
|
||||
|
||||
. = $bfff
|
||||
BYTE #$ff
|
||||
|
Loading…
Reference in New Issue
Block a user