2020-01-12 08:10:01 +00:00
|
|
|
#importonce
|
2020-01-19 06:48:59 +00:00
|
|
|
#import "../libs/print.asm"
|
2020-01-12 08:10:01 +00:00
|
|
|
|
2020-01-13 00:52:10 +00:00
|
|
|
// ========================================================
|
|
|
|
// ////// MACROS //////////////////////////////////////////
|
|
|
|
// ========================================================
|
|
|
|
|
|
|
|
// --------------------------------------------------------
|
|
|
|
// ModulePrintVersion -
|
|
|
|
// Print out module version in the form of MAJ.MIN.REV.
|
|
|
|
// Exanple: 1.3.0.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// versionPtr = Pointer to string Address
|
|
|
|
// --------------------------------------------------------
|
|
|
|
.macro ModulePrintVersion(versionPtr) {
|
|
|
|
lda #<versionPtr // Low byte
|
|
|
|
ldx #>versionPtr // High byte
|
|
|
|
jsr Module.printVersion
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------
|
|
|
|
// ModulePrintType -
|
|
|
|
// Print out module Type based on Module.TYPES defs
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// versionPtr = Pointer to module type address
|
|
|
|
// --------------------------------------------------------
|
|
|
|
.macro ModulePrintType(typePtr) {
|
|
|
|
lda typePtr
|
|
|
|
jsr Module.printType
|
2020-01-12 08:10:01 +00:00
|
|
|
}
|
|
|
|
|
2020-01-13 00:52:10 +00:00
|
|
|
// --------------------------------------------------------
|
|
|
|
// ModuleToDebug -
|
|
|
|
// Print out default module information.
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// moduleType = Pointer to module type address
|
|
|
|
// moduleName = Pointer to module name address
|
|
|
|
// moduleVersion = Pointer to module version address
|
|
|
|
// --------------------------------------------------------
|
|
|
|
.macro ModuleToDebug(moduleType, moduleName, moduleVersion) {
|
|
|
|
ModulePrintType(moduleType)
|
|
|
|
lda #':'
|
|
|
|
PrintChar()
|
|
|
|
PrintLine(moduleName)
|
|
|
|
lda #$20
|
|
|
|
PrintChar()
|
|
|
|
ModulePrintVersion(moduleVersion)
|
2020-01-12 08:10:01 +00:00
|
|
|
PrintNewLine()
|
|
|
|
}
|
|
|
|
|
2020-01-13 00:52:10 +00:00
|
|
|
|
2020-01-12 08:10:01 +00:00
|
|
|
.filenamespace Module
|
|
|
|
|
2020-01-13 00:52:10 +00:00
|
|
|
// ========================================================
|
|
|
|
// ////// CONSTANTS ///////////////////////////////////////
|
|
|
|
// ========================================================
|
|
|
|
|
|
|
|
.namespace TYPES {
|
2020-01-20 07:32:37 +00:00
|
|
|
.label MAIN = 00
|
|
|
|
.label LIB = 01
|
|
|
|
.label PROG = 02
|
|
|
|
.label CORE = 03
|
|
|
|
.label DEVICE = 04
|
|
|
|
|
2020-01-13 00:52:10 +00:00
|
|
|
}
|
|
|
|
|
2020-01-12 08:10:01 +00:00
|
|
|
|
2020-01-13 00:52:10 +00:00
|
|
|
* = * "Module Lib"
|
2020-01-12 08:10:01 +00:00
|
|
|
|
2020-01-13 00:52:10 +00:00
|
|
|
// ========================================================
|
|
|
|
// ////// METHODS /////////////////////////////////////////
|
|
|
|
// ========================================================
|
|
|
|
|
|
|
|
// --------------------------------------------------------
|
|
|
|
// init -
|
|
|
|
// Module Init.
|
|
|
|
// --------------------------------------------------------
|
2020-01-12 08:10:01 +00:00
|
|
|
init: {
|
|
|
|
rts
|
|
|
|
}
|
|
|
|
|
2020-01-13 00:52:10 +00:00
|
|
|
// --------------------------------------------------------
|
|
|
|
// toDebug -
|
|
|
|
// Print debug info.
|
|
|
|
// --------------------------------------------------------
|
2020-01-12 08:10:01 +00:00
|
|
|
toDebug: {
|
2020-01-13 00:52:10 +00:00
|
|
|
ModuleToDebug(module_type, module_name, version)
|
2020-01-12 08:10:01 +00:00
|
|
|
rts
|
|
|
|
}
|
|
|
|
|
2020-01-13 00:52:10 +00:00
|
|
|
// --------------------------------------------------------
|
|
|
|
// printVersion -
|
|
|
|
// Print out module version
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// A = Version High Pointer
|
|
|
|
// X = Version Low Pointer
|
|
|
|
// --------------------------------------------------------
|
2020-01-12 08:10:01 +00:00
|
|
|
printVersion: {
|
2020-01-13 00:52:10 +00:00
|
|
|
sta MemMap.MODULE.versionPtr
|
|
|
|
stx MemMap.MODULE.versionPtr+1
|
|
|
|
ldy #0
|
2020-01-19 06:48:59 +00:00
|
|
|
jsr printNext // Major
|
2020-01-13 00:52:10 +00:00
|
|
|
lda #'.'
|
2020-01-12 08:10:01 +00:00
|
|
|
PrintChar()
|
2020-01-19 06:48:59 +00:00
|
|
|
jsr printNext // Minor
|
2020-01-13 00:52:10 +00:00
|
|
|
lda #'.'
|
2020-01-12 08:10:01 +00:00
|
|
|
PrintChar()
|
2020-01-19 06:48:59 +00:00
|
|
|
jsr printNext // Revision
|
2020-01-12 08:10:01 +00:00
|
|
|
rts
|
|
|
|
printNext:
|
2020-01-13 00:52:10 +00:00
|
|
|
lda (MemMap.MODULE.versionPtr), y
|
2020-01-12 08:10:01 +00:00
|
|
|
clc
|
2020-01-13 00:52:10 +00:00
|
|
|
adc #$30
|
2020-01-12 08:10:01 +00:00
|
|
|
PrintChar()
|
|
|
|
iny
|
|
|
|
rts
|
2020-01-13 00:52:10 +00:00
|
|
|
}
|
2020-01-12 08:10:01 +00:00
|
|
|
|
2020-01-13 00:52:10 +00:00
|
|
|
// --------------------------------------------------------
|
|
|
|
// printType -
|
|
|
|
// Print out module type based on Module Module.TYPES
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// A = Module Type
|
|
|
|
// --------------------------------------------------------
|
|
|
|
printType: {
|
|
|
|
cmp #Module.TYPES.MAIN
|
|
|
|
bne !+
|
|
|
|
PrintLine(type_main)
|
|
|
|
rts
|
|
|
|
!:
|
|
|
|
cmp #Module.TYPES.LIB
|
|
|
|
bne !+
|
|
|
|
PrintLine(type_lib)
|
|
|
|
rts
|
|
|
|
!:
|
|
|
|
cmp #Module.TYPES.CORE
|
|
|
|
bne !+
|
|
|
|
PrintLine(type_core)
|
|
|
|
rts
|
2020-01-20 07:32:37 +00:00
|
|
|
!:
|
|
|
|
cmp #Module.TYPES.DEVICE
|
|
|
|
bne !+
|
|
|
|
PrintLine(type_device)
|
|
|
|
rts
|
2020-01-13 00:52:10 +00:00
|
|
|
!:
|
|
|
|
cmp #Module.TYPES.PROG
|
|
|
|
bne !+
|
|
|
|
PrintLine(type_prog)
|
|
|
|
!:
|
|
|
|
rts
|
2020-01-12 08:10:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-01-13 00:52:10 +00:00
|
|
|
// ========================================================
|
|
|
|
// ////// DATA ////////////////////////////////////////////
|
|
|
|
// ========================================================
|
2020-01-12 08:10:01 +00:00
|
|
|
|
|
|
|
* = * "Module Lib Data"
|
2020-01-19 06:48:59 +00:00
|
|
|
module_type: .byte Module.TYPES.CORE
|
|
|
|
version: .byte 1, 2, 0
|
2020-01-12 08:10:01 +00:00
|
|
|
|
|
|
|
.encoding "screencode_mixed"
|
|
|
|
module_name:
|
2020-01-13 00:52:10 +00:00
|
|
|
.text "module"
|
|
|
|
.byte 0
|
|
|
|
|
|
|
|
// Modile Type Names
|
|
|
|
type_main:
|
|
|
|
.text "main"
|
|
|
|
.byte 0
|
|
|
|
type_core:
|
|
|
|
.text "core"
|
|
|
|
.byte 0
|
|
|
|
type_lib:
|
|
|
|
.text "lib"
|
|
|
|
.byte 0
|
|
|
|
type_prog:
|
|
|
|
.text "prog"
|
|
|
|
.byte 0
|
|
|
|
|
2020-01-20 07:32:37 +00:00
|
|
|
type_device:
|
|
|
|
.text "device"
|
|
|
|
.byte 0
|
2020-01-12 08:10:01 +00:00
|
|
|
|
2020-01-20 07:38:20 +00:00
|
|
|
#import "../hardware/mem_map.asm"
|
2020-01-12 08:10:01 +00:00
|
|
|
|