Load BASIC program in memory, but does not start :-(

This commit is contained in:
giomba 2022-12-04 18:06:59 +01:00
parent f58f40aa3f
commit 313b5a20ab
5 changed files with 143 additions and 19 deletions

2
res/basicstart.asc Normal file
View File

@ -0,0 +1,2 @@
07 10 01 00 8a 00 00 00

BIN
res/basicstart.bin Normal file

Binary file not shown.

BIN
res/data.raw Normal file

Binary file not shown.

BIN
res/stillenacht.raw Normal file

Binary file not shown.

View File

@ -1,27 +1,93 @@
processor 6502 processor 6502
srcPointer = $b5
dstPointer = $b7
dstPointerEnd = $b9
fake_current_byte = $126
count = $128
org $a000 org $a000
WORD .coldstart WORD coldstart
WORD .warmstart WORD warmstart
BYTE #$41, #$30, #$c3, #$c2, #$cd BYTE #$41, #$30, #$c3, #$c2, #$cd
.coldstart: coldstart SUBROUTINE
cld cld
sei sei
;jmp .coldstart
jsr $fd8d jsr $fd8d ; initialize and test RAM
jsr $fd52 jsr $fd52 ; restore default I/O vectors
jsr $fdf9 jsr $fdf9 ; initialize I/O registers
jsr $e518 jsr $e518 ; initialize hardware
cli ; enable interrupts
lda $0288 lda $0288
sta $0294 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 lda #$02
ldx #$00 ldx #$00
clear_color_ram: clear_color_ram:
@ -35,7 +101,7 @@ clear_color_ram:
ldx #$00 ldx #$00
print: print:
lda message,x lda message,x
beq .end beq infine_loop
sec sec
sbc #$40 sbc #$40
sta 7724,x sta 7724,x
@ -45,20 +111,76 @@ print:
inx inx
jmp print jmp print
.end: infine_loop:
restart:
ldx #$00 ldx #$00
loop: loop:
stx 7680 stx 7680
dex dex
bne loop 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: message:
BYTE "CIAO DEVELER BY GIOMBA",#$0 BYTE "CIAO DEVELER BY GIOMBA",#$0
basicdemo:
.incbin "res/stillenacht.raw"
demoend:
. = $bfff . = $bfff
BYTE #$ff BYTE #$ff