1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-10 10:29:36 +00:00

- Fixed a silly mistake where the banked close call fragment sequence was wrong. I first need to read the current bank, store it in the stack, then change the current bank. After jsr return, pop the old bank from the stack and store it.

This commit is contained in:
Sven Van de Velde 2023-04-12 07:35:45 +02:00
parent 02d9eaf081
commit 3916ee3413
22 changed files with 124 additions and 86 deletions

View File

@ -1,6 +1,7 @@
lda $0
pha
lda #{c1}
sta $0
pha
jsr {la1}
pla
sta $0

View File

@ -1,6 +1,7 @@
lda $1
pha
lda #{c1}
sta $1
pha
jsr {la1}
pla
sta $1

View File

@ -43,9 +43,10 @@
.segment Code
main: {
// plus('0', 7)
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -152,9 +152,9 @@ Uplift Scope [main]
Uplift Scope [plus]
Uplift Scope []
Uplifting [main] best 75 combination
Uplifting [plus] best 75 combination
Uplifting [] best 75 combination
Uplifting [main] best 78 combination
Uplifting [plus] best 78 combination
Uplifting [] best 78 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -208,9 +208,10 @@ main: {
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
plus_from_main:
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -267,7 +268,7 @@ __constant char plus::return#1 = plus::a#0+plus::b#0 // return
FINAL ASSEMBLER
Score: 39
Score: 42
// File Comments
/**
@ -320,9 +321,10 @@ main: {
// plus('0', 7)
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -43,9 +43,10 @@
.segment Code
main: {
// plus('0', 7)
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -152,9 +152,9 @@ Uplift Scope [main]
Uplift Scope [plus]
Uplift Scope []
Uplifting [main] best 75 combination
Uplifting [plus] best 75 combination
Uplifting [] best 75 combination
Uplifting [main] best 78 combination
Uplifting [plus] best 78 combination
Uplifting [] best 78 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -208,9 +208,10 @@ main: {
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
plus_from_main:
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -267,7 +268,7 @@ __constant char plus::return#1 = plus::a#0+plus::b#0 // return
FINAL ASSEMBLER
Score: 39
Score: 42
// File Comments
/**
@ -320,9 +321,10 @@ main: {
// plus('0', 7)
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -43,9 +43,10 @@
.segment Code
main: {
// plus('0', 7)
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -220,10 +220,10 @@ Uplift Scope [plus]
Uplift Scope [min]
Uplift Scope []
Uplifting [main] best 90 combination
Uplifting [plus] best 90 combination
Uplifting [min] best 90 combination
Uplifting [] best 90 combination
Uplifting [main] best 93 combination
Uplifting [plus] best 93 combination
Uplifting [min] best 93 combination
Uplifting [] best 93 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -277,9 +277,10 @@ main: {
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
plus_from_main:
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -357,7 +358,7 @@ char plus::return
FINAL ASSEMBLER
Score: 51
Score: 54
// File Comments
/**
@ -410,9 +411,10 @@ main: {
// plus('0', 7)
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -43,9 +43,10 @@
.segment Code
main: {
// plus('0', 7)
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -220,10 +220,10 @@ Uplift Scope [min]
Uplift Scope [main]
Uplift Scope []
Uplifting [plus] best 90 combination
Uplifting [min] best 90 combination
Uplifting [main] best 90 combination
Uplifting [] best 90 combination
Uplifting [plus] best 93 combination
Uplifting [min] best 93 combination
Uplifting [main] best 93 combination
Uplifting [] best 93 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -277,9 +277,10 @@ main: {
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
plus_from_main:
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -357,7 +358,7 @@ char plus::return
FINAL ASSEMBLER
Score: 51
Score: 54
// File Comments
/**
@ -410,9 +411,10 @@ main: {
// plus('0', 7)
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -43,9 +43,10 @@
.segment Code
main: {
// plus('0', 7)
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -220,10 +220,10 @@ Uplift Scope [plus]
Uplift Scope [min]
Uplift Scope []
Uplifting [main] best 90 combination
Uplifting [plus] best 90 combination
Uplifting [min] best 90 combination
Uplifting [] best 90 combination
Uplifting [main] best 93 combination
Uplifting [plus] best 93 combination
Uplifting [min] best 93 combination
Uplifting [] best 93 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -277,9 +277,10 @@ main: {
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
plus_from_main:
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -357,7 +358,7 @@ char plus::return
FINAL ASSEMBLER
Score: 51
Score: 54
// File Comments
/**
@ -410,9 +411,10 @@ main: {
// plus('0', 7)
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -43,9 +43,10 @@
.segment Code
main: {
// plus('0', 7)
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -220,10 +220,10 @@ Uplift Scope [plus]
Uplift Scope [min]
Uplift Scope []
Uplifting [main] best 90 combination
Uplifting [plus] best 90 combination
Uplifting [min] best 90 combination
Uplifting [] best 90 combination
Uplifting [main] best 93 combination
Uplifting [plus] best 93 combination
Uplifting [min] best 93 combination
Uplifting [] best 93 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -277,9 +277,10 @@ main: {
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
plus_from_main:
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -357,7 +358,7 @@ char plus::return
FINAL ASSEMBLER
Score: 51
Score: 54
// File Comments
/**
@ -410,9 +411,10 @@ main: {
// plus('0', 7)
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -43,9 +43,10 @@
.segment Code
main: {
// plus('0', 7)
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -220,10 +220,10 @@ Uplift Scope [plus]
Uplift Scope [min]
Uplift Scope []
Uplifting [main] best 90 combination
Uplifting [plus] best 90 combination
Uplifting [min] best 90 combination
Uplifting [] best 90 combination
Uplifting [main] best 93 combination
Uplifting [plus] best 93 combination
Uplifting [min] best 93 combination
Uplifting [] best 93 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -277,9 +277,10 @@ main: {
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
plus_from_main:
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -361,7 +362,7 @@ char plus::return
FINAL ASSEMBLER
Score: 51
Score: 54
// File Comments
/**
@ -414,9 +415,10 @@ main: {
// plus('0', 7)
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -43,9 +43,10 @@
.segment Code
main: {
// plus('0', 7)
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -220,10 +220,10 @@ Uplift Scope [plus]
Uplift Scope [min]
Uplift Scope []
Uplifting [main] best 90 combination
Uplifting [plus] best 90 combination
Uplifting [min] best 90 combination
Uplifting [] best 90 combination
Uplifting [main] best 93 combination
Uplifting [plus] best 93 combination
Uplifting [min] best 93 combination
Uplifting [] best 93 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -277,9 +277,10 @@ main: {
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
plus_from_main:
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -361,7 +362,7 @@ char plus::return
FINAL ASSEMBLER
Score: 51
Score: 54
// File Comments
/**
@ -414,9 +415,10 @@ main: {
// plus('0', 7)
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0

View File

@ -43,9 +43,10 @@
.segment Code
main: {
// plus('0', 7)
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -62,9 +63,10 @@ plus: {
.label a = '0'
.label b = 7
// min(a, b)
lda.z 1
pha
lda #1
sta.z 1
pha
jsr min
pla
sta.z 1

View File

@ -221,10 +221,10 @@ Uplift Scope [plus]
Uplift Scope [min]
Uplift Scope []
Uplifting [main] best 105 combination
Uplifting [plus] best 105 combination
Uplifting [min] best 105 combination
Uplifting [] best 105 combination
Uplifting [main] best 111 combination
Uplifting [plus] best 111 combination
Uplifting [min] best 111 combination
Uplifting [] best 111 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -278,9 +278,10 @@ main: {
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
plus_from_main:
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -306,9 +307,10 @@ plus: {
// [5] call min
// [7] phi from plus to min [phi:plus->min] -- call_phi_close_cx16_rom
min_from_plus:
lda.z 1
pha
lda #1
sta.z 1
pha
jsr min
pla
sta.z 1
@ -364,7 +366,7 @@ char plus::return
FINAL ASSEMBLER
Score: 66
Score: 72
// File Comments
/**
@ -417,9 +419,10 @@ main: {
// plus('0', 7)
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -443,9 +446,10 @@ plus: {
// min(a, b)
// [5] call min
// [7] phi from plus to min [phi:plus->min] -- call_phi_close_cx16_rom
lda.z 1
pha
lda #1
sta.z 1
pha
jsr min
pla
sta.z 1

View File

@ -43,9 +43,10 @@
.segment Code
main: {
// plus('0', 7)
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -62,9 +63,10 @@ plus: {
.label a = '0'
.label b = 7
// min(a, b)
lda.z 1
pha
lda #1
sta.z 1
pha
jsr min
pla
sta.z 1

View File

@ -221,10 +221,10 @@ Uplift Scope [plus]
Uplift Scope [min]
Uplift Scope []
Uplifting [main] best 105 combination
Uplifting [plus] best 105 combination
Uplifting [min] best 105 combination
Uplifting [] best 105 combination
Uplifting [main] best 111 combination
Uplifting [plus] best 111 combination
Uplifting [min] best 111 combination
Uplifting [] best 111 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
@ -278,9 +278,10 @@ main: {
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
plus_from_main:
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -306,9 +307,10 @@ plus: {
// [5] call min
// [7] phi from plus to min [phi:plus->min] -- call_phi_close_cx16_rom
min_from_plus:
lda.z 1
pha
lda #1
sta.z 1
pha
jsr min
pla
sta.z 1
@ -364,7 +366,7 @@ char plus::return
FINAL ASSEMBLER
Score: 66
Score: 72
// File Comments
/**
@ -417,9 +419,10 @@ main: {
// plus('0', 7)
// [1] call plus
// [4] phi from main to plus [phi:main->plus] -- call_phi_close_cx16_ram
lda.z 0
pha
lda #1
sta.z 0
pha
jsr plus
pla
sta.z 0
@ -443,9 +446,10 @@ plus: {
// min(a, b)
// [5] call min
// [7] phi from plus to min [phi:plus->min] -- call_phi_close_cx16_rom
lda.z 1
pha
lda #1
sta.z 1
pha
jsr min
pla
sta.z 1