Make some automatic computation, remove hardcoded values.

This commit is contained in:
giomba 2022-12-04 20:23:44 +01:00
parent 5daf3c9b39
commit ba41f285d4
1 changed files with 15 additions and 28 deletions

View File

@ -8,6 +8,7 @@ count = $128
org $a000
; autostart cartridge magic number
WORD coldstart
WORD coldstart
BYTE #$41, #$30, #$c3, #$c2, #$cd
@ -47,9 +48,9 @@ coldstart SUBROUTINE
sta $3b
; set start of variables
lda #<($1001 + demoend - basicdemo)
lda #<($1001 + demo_end - demo_start)
sta $2d
lda #>($1001 + demoend - basicdemo)
lda #>($1001 + demo_end - demo_start)
sta $2e
jsr clear_color_ram
@ -69,6 +70,7 @@ coldstart SUBROUTINE
jmp $c483 ; BASIC
; custom hijacked command line
fake_input_line:
BYTE "RUN",#$0d,#0,#0,#0
@ -82,13 +84,6 @@ fake_chrin SUBROUTINE
dey
sty fake_current_byte
; sei
; lda #$f2
; sta $324
; lda #$0e
; sta $325
; cli
.end_fake_chrin:
clc
rts
@ -104,28 +99,19 @@ clear_color_ram SUBROUTINE
bne .loop
rts
print_message SUBROUTINE
ldx #$00
print:
lda message,x
beq .end
sec
sbc #$40
sta 7834,x
inx
jmp print
.end:
rts
; This routine does a lot of unnecessary things,
; but I added a lot of garbage things to debug it,
; because it did not work as intended.
; In the end, the problem was elsewhere, as usual.
copycode SUBROUTINE
sei
lda #0
sta count
sta count + 1
lda #<basicdemo
lda #<demo_start
sta srcPointer
lda #>basicdemo
lda #>demo_start
sta srcPointer + 1
lda #$01
@ -153,10 +139,10 @@ copyloop:
; lenght of program to copy
lda count
cmp #$00
cmp #<DEMO_LEN
bne copyloop
lda count + 1
cmp #$06
cmp #>DEMO_LEN
bne copyloop
cli
@ -167,9 +153,10 @@ message:
BYTE #$0d,#$0d,"PLEASE WAIT 20 SEC",#$0d,"I'M JUST",#$0d,"AN OLD COMPUTER",#$0d,#0
; https://www.commodore.ca/manuals/funet/cbm/vic20/demos.basic/unexpanded/Stillenacht.prg
basicdemo:
demo_start:
.incbin "res/stillenacht.raw"
demoend:
demo_end:
DEMO_LEN SET demo_end - demo_start
. = $bffc
jmp coldstart