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