kernel -> kernal

This commit is contained in:
Irmen de Jong 2021-02-21 22:48:06 +01:00
parent 001d01fdaf
commit edf9a500d3
16 changed files with 24 additions and 28 deletions

View File

@ -52,7 +52,7 @@ What does Prog8 provide?
- "c64": Commodore-64 (6510 CPU = almost a 6502) - "c64": Commodore-64 (6510 CPU = almost a 6502)
- "cx16": [CommanderX16](https://www.commanderx16.com) (65c02 CPU) - "cx16": [CommanderX16](https://www.commanderx16.com) (65c02 CPU)
- If you only use standard kernel and prog8 library routines, it is possible to compile the *exact same program* for both machines (just change the compiler target flag)! - If you only use standard kernal and prog8 library routines, it is possible to compile the *exact same program* for both machines (just change the compiler target flag)!

View File

@ -11,7 +11,7 @@ c64 {
&ubyte TIME_HI = $a0 ; software jiffy clock, hi byte &ubyte TIME_HI = $a0 ; software jiffy clock, hi byte
&ubyte TIME_MID = $a1 ; .. mid byte &ubyte TIME_MID = $a1 ; .. mid byte
&ubyte TIME_LO = $a2 ; .. lo byte. Updated by IRQ every 1/60 sec &ubyte TIME_LO = $a2 ; .. lo byte. Updated by IRQ every 1/60 sec
&ubyte STATUS = $90 ; kernel status variable for I/O &ubyte STATUS = $90 ; kernal status variable for I/O
&ubyte STKEY = $91 ; various keyboard statuses (updated by IRQ) &ubyte STKEY = $91 ; various keyboard statuses (updated by IRQ)
&ubyte SFDX = $cb ; current key pressed (matrix value) (updated by IRQ) &ubyte SFDX = $cb ; current key pressed (matrix value) (updated by IRQ)

View File

@ -586,7 +586,7 @@ _colormod sta $ffff ; modified
} }
asmsub plot (ubyte col @ Y, ubyte row @ A) clobbers(A) { asmsub plot (ubyte col @ Y, ubyte row @ A) clobbers(A) {
; ---- safe wrapper around PLOT kernel routine, to save the X register. ; ---- safe wrapper around PLOT kernal routine, to save the X register.
%asm {{ %asm {{
stx P8ZP_SCRATCH_REG stx P8ZP_SCRATCH_REG
tax tax

View File

@ -2,7 +2,7 @@
; Bitmap pixel graphics routines for the CommanderX16 ; Bitmap pixel graphics routines for the CommanderX16
; Custom routines to use the full-screen 640x480 and 320x240 screen modes. ; Custom routines to use the full-screen 640x480 and 320x240 screen modes.
; (These modes are not supported by the documented GRAPH_xxxx kernel routines) ; (These modes are not supported by the documented GRAPH_xxxx kernal routines)
; ;
; No text layer is currently shown, text can be drawn as part of the bitmap itself. ; No text layer is currently shown, text can be drawn as part of the bitmap itself.
; Note: for similar graphics routines that also work on the C-64, use the "graphics" module instead. ; Note: for similar graphics routines that also work on the C-64, use the "graphics" module instead.

View File

@ -717,7 +717,7 @@ sub setcc2 (ubyte column, ubyte row, ubyte char, ubyte colors) {
} }
asmsub plot (ubyte col @ Y, ubyte row @ A) clobbers(A) { asmsub plot (ubyte col @ Y, ubyte row @ A) clobbers(A) {
; ---- safe wrapper around PLOT kernel routine, to save the X register. ; ---- safe wrapper around PLOT kernal routine, to save the X register.
%asm {{ %asm {{
phx phx
tax tax

View File

@ -107,7 +107,7 @@ internal class BeforeAsmGenerationAstChanger(val program: Program, val errors: I
} }
// add the implicit return statement at the end (if it's not there yet), but only if it's not a kernel routine. // add the implicit return statement at the end (if it's not there yet), but only if it's not a kernal routine.
// and if an assembly block doesn't contain a rts/rti, and some other situations. // and if an assembly block doesn't contain a rts/rti, and some other situations.
val mods = mutableListOf<IAstModification>() val mods = mutableListOf<IAstModification>()
val returnStmt = Return(null, subroutine.position) val returnStmt = Return(null, subroutine.position)

View File

@ -32,7 +32,7 @@ internal class AstVariousTransforms(private val program: Program) : AstWalker()
} }
override fun after(subroutine: Subroutine, parent: Node): Iterable<IAstModification> { override fun after(subroutine: Subroutine, parent: Node): Iterable<IAstModification> {
// For non-kernel subroutines and non-asm parameters: // For non-kernal subroutines and non-asm parameters:
// inject subroutine params as local variables (if they're not there yet). // inject subroutine params as local variables (if they're not there yet).
val symbolsInSub = subroutine.allDefinedSymbols() val symbolsInSub = subroutine.allDefinedSymbols()
val namesInSub = symbolsInSub.map{ it.first }.toSet() val namesInSub = symbolsInSub.map{ it.first }.toSet()

View File

@ -102,7 +102,7 @@ internal object C64MachineDefinition: IMachineDefinition {
0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c,
0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,
0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0xff 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0xff
// 0x90-0xfa is 'kernel work storage area' // 0x90-0xfa is 'kernal work storage area'
)) ))
} }

View File

@ -354,7 +354,7 @@ internal class AsmGen(private val program: Program,
} }
private fun memdefs2asm(statements: List<Statement>) { private fun memdefs2asm(statements: List<Statement>) {
out("\n; memdefs and kernel subroutines") out("\n; memdefs and kernal subroutines")
val memvars = statements.filterIsInstance<VarDecl>().filter { it.type==VarDeclType.MEMORY || it.type==VarDeclType.CONST } val memvars = statements.filterIsInstance<VarDecl>().filter { it.type==VarDeclType.MEMORY || it.type==VarDeclType.CONST }
for(m in memvars) { for(m in memvars) {
if(m.value is NumericLiteralValue) if(m.value is NumericLiteralValue)
@ -367,7 +367,7 @@ internal class AsmGen(private val program: Program,
val addr = sub.asmAddress val addr = sub.asmAddress
if(addr!=null) { if(addr!=null) {
if(sub.statements.isNotEmpty()) if(sub.statements.isNotEmpty())
throw AssemblyError("kernel subroutine cannot have statements") throw AssemblyError("kernal subroutine cannot have statements")
out(" ${sub.name} = ${addr.toHex()}") out(" ${sub.name} = ${addr.toHex()}")
} }
} }

View File

@ -57,7 +57,7 @@ Language features
- High-level code optimizations, such as const-folding, expression and statement simplifications/rewriting. - High-level code optimizations, such as const-folding, expression and statement simplifications/rewriting.
- Many built-in functions, such as ``sin``, ``cos``, ``rnd``, ``abs``, ``min``, ``max``, ``sqrt``, ``msb``, ``rol``, ``ror``, ``swap``, ``sort`` and ``reverse`` - Many built-in functions, such as ``sin``, ``cos``, ``rnd``, ``abs``, ``min``, ``max``, ``sqrt``, ``msb``, ``rol``, ``ror``, ``swap``, ``sort`` and ``reverse``
- Supports the sixteen 'virtual' 16-bit registers R0 .. R15 from the Commander X16, also on the C64. - Supports the sixteen 'virtual' 16-bit registers R0 .. R15 from the Commander X16, also on the C64.
- If you only use standard kernel and prog8 library routines, it is possible to compile the *exact same program* for both machines (just change the compiler target flag)! - If you only use standard kernal and prog8 library routines, it is possible to compile the *exact same program* for both machines (just change the compiler target flag)!
Code example Code example

View File

@ -182,7 +182,7 @@ Provides string manipulation routines.
floats floats
------ ------
Provides definitions for the ROM/kernel subroutines and utility routines dealing with floating Provides definitions for the ROM/kernal subroutines and utility routines dealing with floating
point variables. This includes ``print_f``, the routine used to print floating point numbers. point variables. This includes ``print_f``, the routine used to print floating point numbers.

View File

@ -70,7 +70,7 @@ Directives
It's not possible to return cleanly to BASIC when the program exits. The only choice is It's not possible to return cleanly to BASIC when the program exits. The only choice is
to perform a system reset. (A ``system_reset`` subroutine is available in the syslib to help you do this) to perform a system reset. (A ``system_reset`` subroutine is available in the syslib to help you do this)
- style ``floatsafe`` -- like the previous one but also reserves the addresses that - style ``floatsafe`` -- like the previous one but also reserves the addresses that
are required to perform floating point operations (from the BASIC kernel). No clean exit is possible. are required to perform floating point operations (from the BASIC kernal). No clean exit is possible.
- style ``basicsafe`` -- the most restricted mode; only use the handful 'free' addresses in the ZP, and don't - style ``basicsafe`` -- the most restricted mode; only use the handful 'free' addresses in the ZP, and don't
touch change anything else. This allows full use of BASIC and KERNAL ROM routines including default IRQs touch change anything else. This allows full use of BASIC and KERNAL ROM routines including default IRQs
during normal system operation. during normal system operation.
@ -514,7 +514,7 @@ Multiple return values
^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
Normal subroutines can only return zero or one return values. Normal subroutines can only return zero or one return values.
However, the special ``asmsub`` routines (implemented in assembly code) or ``romsub`` routines However, the special ``asmsub`` routines (implemented in assembly code) or ``romsub`` routines
(referencing a routine in kernel ROM) can return more than one return value. (referencing a routine in kernal ROM) can return more than one return value.
For example a status in the carry bit and a number in A, or a 16-bit value in A/Y registers. For example a status in the carry bit and a number in A, or a 16-bit value in A/Y registers.
It is not possible to process the results of a call to these kind of routines It is not possible to process the results of a call to these kind of routines
directly from the language, because only single value assignments are possible. directly from the language, because only single value assignments are possible.

View File

@ -17,7 +17,7 @@ Currently there are two machines that are supported as compiler target (selectab
This chapter explains the relevant system details of these machines. This chapter explains the relevant system details of these machines.
.. hint:: .. hint::
If you only use standard kernel and prog8 library routines, If you only use standard kernal and prog8 library routines,
it is possible to compile the *exact same program* for both machines (just change the compiler target flag)! it is possible to compile the *exact same program* for both machines (just change the compiler target flag)!

View File

@ -50,7 +50,7 @@ Calling the routine is just a simple JSR instruction, but the other two work lik
``asmsub`` routines ``asmsub`` routines
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
These are usually declarations of kernel (ROM) routines or low-level assembly only routines, These are usually declarations of kernal (ROM) routines or low-level assembly only routines,
that have their arguments solely passed into specific registers. that have their arguments solely passed into specific registers.
Sometimes even via a processor status flag such as the Carry flag. Sometimes even via a processor status flag such as the Carry flag.
Return values also via designated registers. Return values also via designated registers.

View File

@ -2,7 +2,6 @@
TODO TODO
==== ====
- rename kernel -> kernal
- add sound to the cx16 tehtriz - add sound to the cx16 tehtriz
- add const arrays and cost strings - add const arrays and cost strings

View File

@ -7,11 +7,17 @@ main {
; $1F9C0 - $1F9FF PSG registers ; $1F9C0 - $1F9FF PSG registers
sub start() { sub start() {
c64.set_rasterirq(&irq.irq, 100, true) uword color=0
repeat {
cx16.vpoke(1, $fa00+6*2, lsb(color))
cx16.vpoke(1, $fa01+6*2, msb(color))
color++
}
;c64.set_rasterirq(&irq.irq, 100, true)
sys.wait(100) sys.wait(100)
c64.restore_irq() ;c64.restore_irq()
; uword freq = 1181 ; uword freq = 1181
; cx16.vpoke(1, $f9c0, lsb(freq)) ; cx16.vpoke(1, $f9c0, lsb(freq))
@ -26,15 +32,6 @@ irq {
uword counter = 0 uword counter = 0
sub irq() { sub irq() {
c64.EXTCOL++
ubyte xx
repeat 20 {
xx++
}
c64.EXTCOL--
@($0400) = lsb(counter)
@($0401) = msb(counter)
counter++ counter++
} }