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

- Automated the startup init procedures of libraries. For example, conio needs to call the conio init procedure automatically. This procedure is automatically called from the programs that import the libraries, where their __start procedure calls the library __start procedure. To avoid name conflicts, the library start procedures are named __libraryname_start and are embedded into the library name space.

- Reworked the start procedure name for all classes, now the routine getStartProcedureName is called.
This commit is contained in:
Sven Van de Velde 2023-11-18 11:44:08 +01:00
parent 1209353803
commit bcd7a49f6a
8 changed files with 163 additions and 162 deletions

View File

@ -334,6 +334,10 @@ public class Program {
return startProcedure;
}
public String getStartProcedureName() {
return startProcedure.getFullName();
}
public void setStartProcedure(ProcedureRef startProcedure) {
this.startProcedure = startProcedure;
}

View File

@ -186,8 +186,12 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
// Add the _start() procedure to the program
{
program.setStartProcedure(new ProcedureRef(SymbolRef.START_PROC_NAME));
final Procedure startProcedure = new Procedure(SymbolRef.START_PROC_NAME, new SymbolTypeProcedure(SymbolType.VOID, new ArrayList<>()), program.getScope(), Scope.SEGMENT_CODE_DEFAULT, Scope.SEGMENT_DATA_DEFAULT, Procedure.CallingConvention.PHI_CALL, Bank.COMMON);
String startProcedureName = SymbolRef.START_PROC_NAME;
if (asmLibrary != null) {
startProcedureName = "__" + asmLibrary + "_start";
}
program.setStartProcedure(new ProcedureRef(startProcedureName));
final Procedure startProcedure = new Procedure(program.getStartProcedureName(), new SymbolTypeProcedure(SymbolType.VOID, new ArrayList<>()), program.getScope(), Scope.SEGMENT_CODE_DEFAULT, Scope.SEGMENT_DATA_DEFAULT, Procedure.CallingConvention.PHI_CALL, Bank.COMMON);
startProcedure.setParameters(new ArrayList<>());
program.getScope().add(startProcedure);
final ProcedureCompilation startProcedureCompilation = program.createProcedureCompilation(startProcedure.getRef());
@ -222,6 +226,11 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
throw new CompileError("main() has wrong number of parameters. It must have zero or 2 parameters.", mainProc.getDefinitionSource());
}
// For each imported library, call the __start procedure of the library.
for(AsmLibrary importedLibrary: program.getAsmImports().values()) {
startSequence.addStatement( new StatementCall(null, "__" + importedLibrary.getFullName() + "_start", new ArrayList<>(), StatementSource.NONE, Comment.NO_COMMENTS));
}
final Label startReturnLabel = startProcedure.addLabel(SymbolRef.PROCEXIT_BLOCK_NAME);
startSequence.addStatement(new StatementLabel(startReturnLabel.getRef(), StatementSource.NONE, Comment.NO_COMMENTS));
startSequence.addStatement(new StatementReturn(null, StatementSource.NONE, Comment.NO_COMMENTS));

View File

@ -32,7 +32,7 @@ public class Pass1AssertUsedVars extends Pass1Base {
getProgram().clearControlFlowBlockSuccessorClosure();
VariableReferenceInfos referenceInfos = getProgram().getVariableReferenceInfos();
Graph.Block startBlock = getProgram().getGraph().getBlock(new LabelRef(SymbolRef.START_PROC_NAME));
Graph.Block startBlock = getProgram().getGraph().getBlock(new LabelRef(this.getProgram().getStartProcedureName()));
final LinkedHashSet<SymbolVariableRef> defined = new LinkedHashSet<>();
// Add all variables with an init-value
for(Variable var : getProgramScope().getAllVars(true)) {

View File

@ -21,7 +21,7 @@ public class PassNEliminateEmptyStart extends Pass2SsaOptimization {
@Override
public boolean step() {
final ProcedureRef startProcRef = new ProcedureRef(SymbolRef.START_PROC_NAME);
final ProcedureRef startProcRef = new ProcedureRef(this.getProgram().getStartProcedureName());
StatementCall singleCall = getSingleCall(startProcRef);
if(singleCall != null) {
// Are there any constants in the scope that are used elsewhere?

View File

@ -27,7 +27,7 @@ public class PassNEliminateUnusedConstructors extends Pass2SsaOptimization {
allConstructors.addAll(procedure.getConstructorRefs());
}
Procedure startProc = getProgramScope().getLocalProcedure(SymbolRef.START_PROC_NAME);
Procedure startProc = getProgramScope().getLocalProcedure(this.getProgram().getStartProcedureName());
if(startProc != null) {
// find all constructor-calls in __init() pointing to unused constructors
List<ProcedureRef> unusedConstructors = new ArrayList<>();

View File

@ -57,10 +57,10 @@
.label BRAM = 0
.label BROM = 1
.segment Code
// __start
// void __start()
__start: {
// __start::__init1
// __conio_var_start
// void __conio_var_start()
__conio_var_start: {
// __conio_var_start::__init1
// __export volatile __address(0x00) unsigned char BRAM = 0
// [1] BRAM = 0 -- vbuz1=vbuc1
lda #0
@ -69,12 +69,12 @@ __start: {
// [2] BROM = 4 -- vbuz1=vbuc1
lda #4
sta.z BROM
// [3] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
// __start::@1
// [3] phi from __conio_var_start::__init1 to __conio_var_start::@1 [phi:__conio_var_start::__init1->__conio_var_start::@1]
// __conio_var_start::@1
// #pragma constructor_for(conio_x16_init, cputc, clrscr, cscroll)
// [4] callexecute conio_x16_init -- call_var_near
jsr conio_var.conio_x16_init
// __start::@return
// __conio_var_start::@return
// [5] return
rts
}
@ -83,10 +83,10 @@ __start: {
/// Set initial screen values.
// void conio_x16_init()
conio_x16_init: {
.label conio_x16_init__4 = $1c
.label conio_x16_init__5 = $1f
.label conio_x16_init__6 = $1c
.label conio_x16_init__7 = $1f
.label conio_x16_init__4 = $e
.label conio_x16_init__5 = $d
.label conio_x16_init__6 = $e
.label conio_x16_init__7 = 4
// screenlayer1()
// [7] callexecute screenlayer1 -- call_var_near
jsr conio_var.screenlayer1
@ -168,11 +168,11 @@ screenlayer1: {
// If onoff is 1, scrolling is enabled when outputting past the end of the screen
// If onoff is 0, scrolling is disabled and the cursor instead moves to (0,0)
// The function returns the old scroll setting.
// __zp($24) char scroll(__zp($32) char onoff)
// __zp($d) char scroll(__zp(5) char onoff)
scroll: {
.label onoff = $32
.label return = $24
.label old = $24
.label onoff = 5
.label return = $d
.label old = $d
// char old = __conio.scroll[__conio.layer]
// [31] scroll::old#0 = ((char *)&__conio+$f)[*((char *)&__conio+2)] -- vbuz1=pbuc1_derefidx_(_deref_pbuc2)
ldy __conio+2
@ -193,11 +193,11 @@ scroll: {
// If onoff is 1, a cursor is displayed when waiting for keyboard input.
// If onoff is 0, the cursor is hidden when waiting for keyboard input.
// The function returns the old cursor setting.
// __zp($18) char cursor(__zp($2f) char onoff)
// __zp(4) char cursor(__zp(5) char onoff)
cursor: {
.label onoff = $2f
.label return = $18
.label old = $18
.label onoff = 5
.label return = 4
.label old = 4
// char old = __conio.cursor
// [35] cursor::old#0 = *((char *)&__conio+$c) -- vbuz1=_deref_pbuc1
// not supported in CX16
@ -234,10 +234,10 @@ kbhit: {
}
// bordercolor
// Set the color for the border.
// __zp($25) char bordercolor(__zp($25) char color)
// __zp(4) char bordercolor(__zp(3) char color)
bordercolor: {
.label color = $25
.label return = $25
.label color = 3
.label return = 4
// __conio.bordercolor = *VERA_DC_BORDER
// [44] *((char *)&__conio+$e) = *VERA_DC_BORDER -- _deref_pbuc1=_deref_pbuc2
lda VERA_DC_BORDER
@ -255,13 +255,13 @@ bordercolor: {
// - color: a 4 bit value ( decimal between 0 and 15).
// This will only work when the VERA is in 16 color mode!
// Note that on the VERA, the transparent color has value 0.
// __zp($17) char bgcolor(__zp($1b) char color)
// __zp(2) char bgcolor(__zp(3) char color)
bgcolor: {
.label color = $1b
.label return = $17
.label bgcolor__0 = $17
.label bgcolor__1 = $1b
.label bgcolor__2 = $17
.label color = 3
.label return = 2
.label bgcolor__0 = $a
.label bgcolor__1 = 3
.label bgcolor__2 = $a
// __conio.color & 0x0F
// [47] bgcolor::$0 = *((char *)&__conio+$d) & $f -- vbuz1=_deref_pbuc1_band_vbuc2
lda #$f
@ -296,12 +296,12 @@ bgcolor: {
// - color: a 4 bit value ( decimal between 0 and 15).
// This will only work when the VERA is in 16 color mode!
// Note that on the VERA, the transparent color has value 0.
// __zp($16) char textcolor(__zp($2c) char color)
// __zp(2) char textcolor(__zp(6) char color)
textcolor: {
.label color = $2c
.label return = $16
.label textcolor__0 = $16
.label textcolor__1 = $16
.label color = 6
.label return = 2
.label textcolor__0 = $a
.label textcolor__1 = $a
// __conio.color & 0xF0
// [53] textcolor::$0 = *((char *)&__conio+$d) & $f0 -- vbuz1=_deref_pbuc1_band_vbuc2
lda #$f0
@ -326,18 +326,14 @@ textcolor: {
// cputsxy
// Move cursor and output a NUL-terminated string
// Same as "gotoxy (x, y); puts (s);"
// void cputsxy(__zp($2b) char x, __zp($31) char y, __zp($36) const char *s)
// void cputsxy(__zp($d) char x, __zp(2) char y, __zp($10) const char *s)
cputsxy: {
.label x = $2b
.label y = $31
.label s = $36
.label x = $d
.label y = 2
.label s = $10
// gotoxy(x, y)
// [58] gotoxy::x = cputsxy::x -- vbuz1=vbuz2
lda.z x
sta.z conio_var.gotoxy.x
// [59] gotoxy::y = cputsxy::y -- vbuz1=vbuz2
lda.z y
sta.z conio_var.gotoxy.y
// [58] gotoxy::x = cputsxy::x
// [59] gotoxy::y = cputsxy::y
// [60] callexecute gotoxy -- call_var_near
jsr conio_var.gotoxy
// cputs(s)
@ -355,10 +351,10 @@ cputsxy: {
}
// cputs
// Output a NUL-terminated string at the current cursor position
// void cputs(__zp($20) const char *s)
// void cputs(__zp($e) const char *s)
cputs: {
.label s = $20
.label c = $1e
.label s = $e
.label c = 3
// cputs::@1
__b1:
// while(c=*s++)
@ -393,18 +389,14 @@ cputs: {
// cputcxy
// Move cursor and output one character
// Same as "gotoxy (x, y); cputc (c);"
// void cputcxy(__zp($2a) char x, __zp($30) char y, __zp($35) char c)
// void cputcxy(__zp($d) char x, __zp(2) char y, __zp(7) char c)
cputcxy: {
.label x = $2a
.label y = $30
.label c = $35
.label x = $d
.label y = 2
.label c = 7
// gotoxy(x, y)
// [72] gotoxy::x = cputcxy::x -- vbuz1=vbuz2
lda.z x
sta.z conio_var.gotoxy.x
// [73] gotoxy::y = cputcxy::y -- vbuz1=vbuz2
lda.z y
sta.z conio_var.gotoxy.y
// [72] gotoxy::x = cputcxy::x
// [73] gotoxy::y = cputcxy::y
// [74] callexecute gotoxy -- call_var_near
jsr conio_var.gotoxy
// cputc(c)
@ -424,7 +416,7 @@ cputcxy: {
// Print a newline
// void cputln()
cputln: {
.label cputln__3 = 8
.label cputln__3 = $a
// __conio.cursor_x = 0
// [79] *((char *)&__conio) = 0 -- _deref_pbuc1=vbuc2
lda #0
@ -463,22 +455,23 @@ cputln: {
// cputc
// Output one character at the current cursor position
// Moves the cursor forward. Scrolls the entire screen if needed
// void cputc(__zp($19) char c)
// void cputc(__zp($a) char c)
cputc: {
.const OFFSET_STACK_C = 0
.label c = $19
.label cputc__1 = $14
.label cputc__2 = $14
.label cputc__3 = $14
.label c = 3
.label cputc__1 = 2
.label cputc__2 = $d
.label cputc__3 = 2
.label c_1 = $a
// [87] cputc::c#0 = stackidx(char,cputc::OFFSET_STACK_C) -- vbuz1=_stackidxbyte_vbuc1
tsx
lda STACK_BASE+OFFSET_STACK_C,x
sta.z c
sta.z c_1
// if(c=='\n')
// [88] if(cputc::c#0==' 'pm) goto cputc::@1 -- vbuz1_eq_vbuc1_then_la1
.encoding "petscii_mixed"
lda #'\n'
cmp.z c
cmp.z c_1
beq __b1
// cputc::@2
// *VERA_CTRL &= ~VERA_ADDRSEL
@ -510,7 +503,7 @@ cputc: {
sta VERA_ADDRX_H
// *VERA_DATA0 = c
// [96] *VERA_DATA0 = cputc::c#0 -- _deref_pbuc1=vbuz1
lda.z c
lda.z c_1
sta VERA_DATA0
// *VERA_DATA0 = __conio.color
// [97] *VERA_DATA0 = *((char *)&__conio+$d) -- _deref_pbuc1=_deref_pbuc2
@ -596,9 +589,9 @@ cputc: {
}
// screensizey
// Return the current screen size y height.
// __zp($26) char screensizey()
// __zp(2) char screensizey()
screensizey: {
.label return = $26
.label return = 2
// return __conio.height;
// [114] screensizey::return = *((char *)&__conio+7) -- vbuz1=_deref_pbuc1
lda __conio+7
@ -610,9 +603,9 @@ screensizey: {
}
// screensizex
// Return the current screen size x width.
// __zp($27) char screensizex()
// __zp($d) char screensizex()
screensizex: {
.label return = $27
.label return = $d
// return __conio.width;
// [116] screensizex::return = *((char *)&__conio+6) -- vbuz1=_deref_pbuc1
lda __conio+6
@ -624,16 +617,16 @@ screensizex: {
}
// screensize
// Return the current screen size.
// void screensize(__zp($33) char *x, __zp($38) char *y)
// void screensize(__zp(8) char *x, __zp($10) char *y)
screensize: {
.label x = $33
.label y = $38
.label screensize__1 = $23
.label screensize__2 = $23
.label screensize__4 = $23
.label screensize__5 = $23
.label hscale = $23
.label vscale = $23
.label x = 8
.label y = $10
.label screensize__1 = 2
.label screensize__2 = 2
.label screensize__4 = 3
.label screensize__5 = 3
.label hscale = 2
.label vscale = 3
// char hscale = (*VERA_DC_HSCALE) >> 7
// [118] screensize::hscale#0 = *VERA_DC_HSCALE >> 7 -- vbuz1=_deref_pbuc1_ror_7
// VERA returns in VERA_DC_HSCALE the value of 128 when 80 columns is used in text mode,
@ -700,9 +693,9 @@ screensize: {
}
// wherey
// Return the y position of the cursor
// __zp($28) char wherey()
// __zp(3) char wherey()
wherey: {
.label return = $28
.label return = 3
// return __conio.cursor_y;
// [127] wherey::return = *((char *)&__conio+1) -- vbuz1=_deref_pbuc1
lda __conio+1
@ -714,9 +707,9 @@ wherey: {
}
// wherex
// Return the x position of the cursor
// __zp($29) char wherex()
// __zp(4) char wherex()
wherex: {
.label return = $29
.label return = 4
// return __conio.cursor_x;
// [129] wherex::return = *((char *)&__conio) -- vbuz1=_deref_pbuc1
lda __conio
@ -728,19 +721,19 @@ wherex: {
}
// gotoxy
// Set the cursor to the specified position
// void gotoxy(__zp($b) char x, __zp($d) char y)
// void gotoxy(__zp($d) char x, __zp(2) char y)
gotoxy: {
.label x = $b
.label y = $d
.label gotoxy__1 = $b
.label gotoxy__2 = $b
.label gotoxy__3 = $b
.label gotoxy__5 = $b
.label gotoxy__6 = $b
.label gotoxy__7 = $b
.label gotoxy__8 = $b
.label gotoxy__9 = $e
.label gotoxy__10 = $d
.label x = $d
.label y = 2
.label gotoxy__1 = $d
.label gotoxy__2 = $d
.label gotoxy__3 = $d
.label gotoxy__5 = $a
.label gotoxy__6 = $a
.label gotoxy__7 = $a
.label gotoxy__8 = 4
.label gotoxy__9 = $b
.label gotoxy__10 = 2
// (x>=__conio.width)?__conio.width:x
// [131] if(gotoxy::x>=*((char *)&__conio+6)) goto gotoxy::@1 -- vbuz1_ge__deref_pbuc1_then_la1
lda.z x
@ -817,13 +810,13 @@ gotoxy: {
// clears the screen and moves the cursor to the upper left-hand corner of the screen.
// void clrscr()
clrscr: {
.label clrscr__0 = $22
.label clrscr__1 = $1a
.label clrscr__2 = $1a
.label line_text = $2d
.label l = $22
.label ch = $2d
.label c = $1a
.label clrscr__0 = $d
.label clrscr__1 = 2
.label clrscr__2 = 4
.label line_text = $e
.label l = $d
.label ch = $e
.label c = $a
// unsigned int line_text = __conio.mapbase_offset
// [146] clrscr::line_text#0 = *((unsigned int *)&__conio+3) -- vwuz1=_deref_pwuc1
lda __conio+3
@ -931,9 +924,9 @@ clrscr: {
* @brief Get current x and y cursor position.
* @return An unsigned int where the hi byte is the x coordinate and the low byte is the y coordinate of the screen position.
*/
// __zp($1c) unsigned int cbm_k_plot_get()
// __zp($e) unsigned int cbm_k_plot_get()
cbm_k_plot_get: {
.label return = $1c
.label return = $e
// __mem unsigned char x
// [169] cbm_k_plot_get::x = 0 -- vbum1=vbuc1
lda #0
@ -965,29 +958,29 @@ cbm_k_plot_get: {
.segment CodeConIO
// screenlayer
// --- layer management in VERA ---
// void screenlayer(char layer, __zp($10) char mapbase, __zp($11) char config)
// void screenlayer(char layer, __zp(2) char mapbase, __zp(4) char config)
screenlayer: {
.label screenlayer__0 = $15
.label screenlayer__1 = $10
.label screenlayer__2 = $12
.label screenlayer__5 = $11
.label screenlayer__6 = $11
.label screenlayer__7 = $10
.label screenlayer__8 = $10
.label screenlayer__9 = $10
.label screenlayer__10 = $10
.label screenlayer__11 = $10
.label screenlayer__12 = $10
.label screenlayer__13 = $10
.label screenlayer__14 = $10
.label screenlayer__16 = $10
.label screenlayer__17 = $11
.label screenlayer__18 = $10
.label screenlayer__19 = $10
.label mapbase = $10
.label config = $11
.label mapbase_offset = $12
.label y = $10
.label screenlayer__0 = $d
.label screenlayer__1 = 2
.label screenlayer__2 = $b
.label screenlayer__5 = 4
.label screenlayer__6 = 4
.label screenlayer__7 = 2
.label screenlayer__8 = 2
.label screenlayer__9 = 4
.label screenlayer__10 = 4
.label screenlayer__11 = 4
.label screenlayer__12 = $d
.label screenlayer__13 = $d
.label screenlayer__14 = $d
.label screenlayer__16 = 2
.label screenlayer__17 = 2
.label screenlayer__18 = 4
.label screenlayer__19 = $d
.label mapbase = 2
.label config = 4
.label mapbase_offset = $e
.label y = $a
// __mem char vera_dc_hscale_temp = *VERA_DC_HSCALE
// [174] screenlayer::vera_dc_hscale_temp#0 = *VERA_DC_HSCALE -- vbum1=_deref_pbuc1
lda VERA_DC_HSCALE
@ -1271,12 +1264,12 @@ cscroll: {
// Insert a new line, and scroll the upper part of the screen up.
// void insertup(char rows)
insertup: {
.label insertup__0 = $c
.label insertup__0 = $d
.label insertup__4 = 2
.label insertup__6 = 3
.label insertup__7 = 2
.label width = $c
.label y = 8
.label width = $d
.label y = $a
// __conio.width+1
// [224] insertup::$0 = *((char *)&__conio+6) + 1 -- vbuz1=_deref_pbuc1_plus_1
lda __conio+6
@ -1358,7 +1351,7 @@ clearline: {
.label clearline__1 = 4
.label clearline__2 = 4
.label clearline__3 = 5
.label addr = 9
.label addr = $b
.label c = 2
// unsigned int addr = __conio.offsets[__conio.cursor_y]
// [241] clearline::$3 = *((char *)&__conio+1) << 1 -- vbuz1=_deref_pbuc1_rol_1
@ -1440,19 +1433,19 @@ clearline: {
* @param soffset_vram Offset of the source location in vram.
* @param num16 Specified the amount of bytes to be copied.
*/
// void memcpy8_vram_vram(__zp(5) char dbank_vram, __zp(9) unsigned int doffset_vram, __zp(3) char sbank_vram, __zp(6) unsigned int soffset_vram, __zp(3) char num8)
// void memcpy8_vram_vram(__zp(5) char dbank_vram, __zp($b) unsigned int doffset_vram, __zp(3) char sbank_vram, __zp(8) unsigned int soffset_vram, __zp(3) char num8)
memcpy8_vram_vram: {
.label memcpy8_vram_vram__0 = 4
.label memcpy8_vram_vram__1 = 4
.label memcpy8_vram_vram__2 = 3
.label memcpy8_vram_vram__3 = 3
.label memcpy8_vram_vram__4 = 3
.label memcpy8_vram_vram__3 = 7
.label memcpy8_vram_vram__4 = 6
.label memcpy8_vram_vram__5 = 5
.label num8 = 3
.label dbank_vram = 5
.label doffset_vram = 9
.label doffset_vram = $b
.label sbank_vram = 3
.label soffset_vram = 6
.label soffset_vram = 8
.label num8_1 = 2
// *VERA_CTRL &= ~VERA_ADDRSEL
// [257] *VERA_CTRL = *VERA_CTRL & ~VERA_ADDRSEL -- _deref_pbuc1=_deref_pbuc1_band_vbuc2
@ -1540,24 +1533,23 @@ memcpy8_vram_vram: {
.segment DataConIO
__conio: .fill SIZEOF_STRUCT___0, 0
}
// void __start()
// void conio_x16_init()
// void clrscr()
// void gotoxy(__zp($b) char x, __zp($d) char y)
// __zp($29) char wherex()
// __zp($28) char wherey()
// void screensize(__zp($33) char *x, __zp($38) char *y)
// __zp($27) char screensizex()
// __zp($26) char screensizey()
// void gotoxy(__zp($d) char x, __zp(2) char y)
// __zp(4) char wherex()
// __zp(3) char wherey()
// void screensize(__zp(8) char *x, __zp($10) char *y)
// __zp($d) char screensizex()
// __zp(2) char screensizey()
// void cputln()
// void cputc(__zp($19) char c)
// void cputcxy(__zp($2a) char x, __zp($30) char y, __zp($35) char c)
// void cputs(__zp($20) const char *s)
// void cputsxy(__zp($2b) char x, __zp($31) char y, __zp($36) const char *s)
// __zp($16) char textcolor(__zp($2c) char color)
// __zp($17) char bgcolor(__zp($1b) char color)
// __zp($25) char bordercolor(__zp($25) char color)
// void cputc(__zp($a) char c)
// void cputcxy(__zp($d) char x, __zp(2) char y, __zp(7) char c)
// void cputs(__zp($e) const char *s)
// void cputsxy(__zp($d) char x, __zp(2) char y, __zp($10) const char *s)
// __zp(2) char textcolor(__zp(6) char color)
// __zp(2) char bgcolor(__zp(3) char color)
// __zp(4) char bordercolor(__zp(3) char color)
// char kbhit()
// __zp($18) char cursor(__zp($2f) char onoff)
// __zp($24) char scroll(__zp($32) char onoff)
// __zp(4) char cursor(__zp(5) char onoff)
// __zp($d) char scroll(__zp(5) char onoff)
// void screenlayer1()

View File

@ -3,7 +3,7 @@
#pragma encoding(petscii_mixed)
#pragma var_model(zp)
#pragma asm_library("conio_var")
#pragma asm_export("conio_var", __varcall, __start, conio_x16_init)
#pragma asm_export("conio_var", __varcall, __conio_var_start, conio_x16_init)
#pragma asm_export("conio_var", __varcall, clrscr)
#pragma asm_export("conio_var", __varcall, gotoxy)
#pragma asm_export("conio_var", __varcall, wherex, wherey)

View File

@ -11,7 +11,7 @@
// linked by a "linker".
#pragma asm_import("conio_var", __varcall, conio_x16_init, clrscr, gotoxy)
#pragma asm_import("conio_var", __varcall, __conio_var_start, conio_x16_init, clrscr, gotoxy)
#pragma asm_import("conio_var", __varcall, wherex, wherey)
#pragma asm_import("conio_var", __varcall, screensize, screensizex, screensizey)
#pragma asm_import("conio_var", __stackcall, cputc )
@ -21,7 +21,7 @@
#pragma asm_import("conio_var", __varcall, screenlayer0, screenlayer1)
//#pragma asm_import("conio_var", __varcall, cpeekc, cpeekcxy)
// void __start()
extern void __conio_var_start();
extern void conio_x16_init();
extern void clrscr();
extern void gotoxy(__zp($d) char x, __zp(2) char y);
@ -53,10 +53,6 @@ extern void screenlayer1();
void main() {
asm { jsr conio_var.__start }
textcolor(WHITE);
bgcolor(GREEN);
clrscr();
char c = 'e';