This commit is contained in:
stid 2020-03-08 22:57:30 -07:00
parent e32bd19b47
commit c25178c435
12 changed files with 1701 additions and 29 deletions

View File

@ -9,14 +9,16 @@
#import "../devices/keyboard.asm"
#import "../devices/video.asm"
#import "../progs/woz_shell.asm"
//#import "../progs/stid_shell.asm"
.filenamespace System
// ========================================================
// ////// CONST ///////////////////////////////////////////
// ========================================================
.const MAIN_COLOR = $03
.const BORDER_COLOR = $05
.const MAIN_COLOR = $00
.const BORDER_COLOR = $c
* = * "System Core"
@ -30,12 +32,13 @@
// System Start
// --------------------------------------------------------
start: {
VideoClearColorRam($00)
VideoClearColorRam($03)
VideoClear(' ')
VideoSetBorderColor(BORDER_COLOR)
VideoSetBackgroundColor(MAIN_COLOR)
// Start Main Program
jsr WozShell.start
//jsr StidShell.start
// TODO: Program exited here
// We can ask program to set a ram param and let us know
@ -60,6 +63,7 @@ init: {
jsr Keyboard.init
jsr WozShell.init
//jsr StidShell.init
rts
}
@ -83,6 +87,7 @@ toDebug: {
jsr Video.toDebug
jsr WozShell.toDebug
//jsr StidShell.toDebug
rts
}

View File

@ -32,6 +32,7 @@
}
// --------------------------------------------------------
// VideoClear -
// Fast clear screen characters mem.

View File

@ -23,13 +23,11 @@
CursorRow: .byte 0 // Actual cursor row position
StatusBitsA: .byte 0 // Status Bits
// Bit0: ScrollUpTriggred if ON
}
.namespace MATH {
factor1: .byte 0 // Factor 1 used in MUL ops
factor2: .byte 0 // Factor 2 used in MUL ops
result: .word 0 // 16 Bit math operation result
}
@ -54,6 +52,11 @@
size: .word 0
}
.namespace TIMERS {
counter: .byte 0 // Factor 1 used in MUL ops
}
.namespace MODULE {
versionPtr: .word 0
}
@ -72,5 +75,12 @@
.label buffer = SHELL_BUFFER_ADDR // 256 bytes
}
.namespace STID_SHELL {
pos: .byte 0
mode: .byte 0
sAddr: .word 0
eAddr: .word 0
.label buffer = SHELL_BUFFER_ADDR // 256 bytes
}

View File

@ -99,29 +99,22 @@ printLine: {
// X = lns ascii char result
// --------------------------------------------------------
byteToHex: {
pha //save byte
and #%00001111 //extract lsn
tax //save it
pla //recover byte
lsr //extract...
lsr //msn
pha
jsr !+
tax
pla
lsr
lsr
pha //save msn
txa //lsn
jsr binhex1 //generate ascii lsn
tax //save
pla //get msn & fall thru
//
// convert nybble to hex ascii equivalent...
binhex1:
cmp #$0a
bcc binhex2 //in decimal range
sbc #$09 //hex compensate
lsr
lsr
!: and #$0f
cmp #$0a
bcc !+
adc #6
!: adc #'0'
rts
binhex2:
eor #%00110000 //finalize nybble
rts //done
}
// --------------------------------------------------------

86
libs/timers.asm Normal file
View File

@ -0,0 +1,86 @@
#importonce
#import "../core/module.asm"
// ========================================================
// ////// MACROS //////////////////////////////////////////
// ========================================================
.filenamespace Timers
* = * "Timers Lib"
// ========================================================
// ////// METHODS /////////////////////////////////////////
// ========================================================
// --------------------------------------------------------
// init -
// Module Init.
// --------------------------------------------------------
init: {
rts
}
// --------------------------------------------------------
// toDebug -
// Print debug info.
// --------------------------------------------------------
toDebug: {
ModuleToDebug(module_type, module_name, version)
rts
}
// --------------------------------------------------------
// multiply -
// 8 Bit in to 16 Bit out Multiplier
//
// Parameters:
// MemMap.MATH.factor1 = 8 Bit Factor 1
// MemMap.MATH.factor2 = 8 Bit Factor 2
//
// Result
// MemMap.MATH.result = 16 bit result
// --------------------------------------------------------
delayOne: {
pha
lda #$00
sta MemMap.TIMERS.counter
loop1: lda #$fb // wait for vertical retrace
loop2: cmp $d012 // until it reaches 251th raster line ($fb)
bne loop2 // which is out of the inner screen area
inc MemMap.TIMERS.counter // increase frame counter
lda MemMap.TIMERS.counter // check if counter
cmp #$32 // reached 50
bne out // if not, pass the color changing routine
jmp exit
out:
lda $d012 // make sure we reached
loop3: cmp $d012 // the next raster line so next time we
beq loop3
jmp loop1 // jump to main loop
exit:
pla
rts
}
// ========================================================
// ////// DATA ////////////////////////////////////////////
// ========================================================
* = * "Timers Lib Data"
module_type: .byte Module.TYPES.LIB
version: .byte 1, 0, 0
.encoding "screencode_mixed"
module_name:
.text "timers"
.byte 0
#import "../hardware/mem_map.asm"

View File

@ -12,7 +12,11 @@
#import "./core/boot.asm"
* = * "Kernel Data"
* = $9FFF "EpromFiller"
* = $9FFF "EpromFiller" // 8K Cartridge, $8000-$9FFF (ROML / ROMH).
// * = $BFFF "EpromFiller" // 16K Cartridge, $8000-$9FFF / $A000-$BFFF (ROML / ROMH).
// GAME = 0, EXROM = 0
// ROML/ROMH are read only, Basic ROM is overwritten by ROMH.
.byte 0

View File

@ -15,3 +15,7 @@ eprom:
clean:
rm -Rf ./bin
run:
java -jar ${KICKASS_BIN} -odir ${BUILD_PATH} -log ${BUILD_PATH}/buildlog.txt -showmem ./main.asm
cartconv -t normal -name "woz" -i ${BUILD_PATH}/main.prg -o ${BUILD_PATH}/woz.crt
x64sc ${BUILD_PATH}/woz.crt

BIN
progs/bin/test.bin Normal file

Binary file not shown.

BIN
progs/bin/test.crt Normal file

Binary file not shown.

1324
progs/diag.asm Normal file

File diff suppressed because it is too large Load Diff

195
progs/stid_shell.asm Normal file
View File

@ -0,0 +1,195 @@
#importonce
#import "../core/pseudo.asm"
#import "../core/system.asm"
#import "../libs/print.asm"
#import "../core/module.asm"
#import "../hardware/vic.asm"
#import "../devices/keyboard.asm"
#import "../devices/video.asm"
#import "../hardware/mem_map.asm"
.filenamespace StidShell
* = * "StidShell Routines"
// ========================================================
// ////// CONSTANTS ///////////////////////////////////////
// ========================================================
.const R = $52
.const CR = $0d
.const BS = $14
.const MAX_CMD_BUFFER = 40
.namespace MODE {
.label MEMORY = $48
.label HELP = $4D
}
// ========================================================
// ////// METHODS /////////////////////////////////////////
// ========================================================
init: {
jsr StidShell.clear
rts
}
start: {
PrintLine(lineString)
PrintLine(aboutString)
PrintLine(lineString)
jsr StidShell.printRegs
jmp StidShell.loop
}
clear: {
lda #-1
sta MemMap.STID_SHELL.pos
lda #0
sta MemMap.STID_SHELL.sAddr
sta MemMap.STID_SHELL.eAddr
rts
}
//------------------------------------------------------------------------------------
loop: {
jsr Keyboard.waitForKey
cmp #CR
beq cr
cmp #BS
beq backspace
inputChar:
jsr StidShell.push // Char in Buffer
cpy #MAX_CMD_BUFFER
beq loop
PrintChar()
jmp loop
backspace:
jsr StidShell.backspace
PrintChar()
jmp loop
cr:
jsr StidShell.push // CR in Buffer
jsr Video.screenNewLine
jsr StidShell.exec
jsr Video.screenNewLine
jsr StidShell.clear
jmp loop
}
toDebug: {
ModuleToDebug(module_type, module_name, version)
rts
}
push: {
ldy MemMap.STID_SHELL.pos
iny
cpy #MAX_CMD_BUFFER
beq done
sty MemMap.STID_SHELL.pos
sta MemMap.STID_SHELL.buffer, y
done:
rts
}
backspace: {
ldy MemMap.STID_SHELL.pos
cpy #-1
beq done
dey
sty MemMap.STID_SHELL.pos
done:
rts
}
exec: {
ldy #0
lda MemMap.STID_SHELL.buffer, y
sta MemMap.STID_SHELL.mode // Store as mode
cmp #StidShell.MODE.HELP // H
beq cmdHelp
cmp #StidShell.MODE.MEMORY // M
beq cmdMemory
rts
cmdHelp:
rts
cmdMemory: {
loop:
iny
lda MemMap.STID_SHELL.buffer, y
cmp $20
beq loop
cmp #CR
beq done
done:
rts
}
}
printRegs: {
PrintLine(regString)
lda $02
jsr Print.byteToHex
PrintChar()
txa
PrintChar()
lda $03
jsr Print.byteToHex
PrintChar()
txa
PrintChar()
rts
}
// ========================================================
// ////// DATA ////////////////////////////////////////////
// ========================================================
* = * "StidShell Data"
module_type: .byte Module.TYPES.PROG
version: .byte 0, 0, 1
.encoding "screencode_mixed"
module_name:
.text "stid-shell"
.byte 0
aboutString:
.text "stid mon 0.0.1"
.byte Video.CR, 0
lineString:
.text "----------------------------------------"
.byte Video.CR, 0
regString:
.text " pc sr ac xr yr sp"
.byte Video.CR
.text "; "
.byte 0
#import "../hardware/mem_map.asm"

View File

@ -2,13 +2,19 @@
#import "../core/pseudo.asm"
#import "../core/system.asm"
#import "../libs/print.asm"
#import "../libs/timers.asm"
#import "../core/module.asm"
#import "../hardware/vic.asm"
#import "../devices/keyboard.asm"
#import "../devices/video.asm"
#import "../hardware/mem_map.asm"
.filenamespace WozShell
* = * "WozShell Routines"
// ========================================================
@ -156,7 +162,12 @@ stidExec: {
beq cmdReset
cmp #$56 // V
beq cmdZeroPageInfo
beq cmdSysInfo
.break
cmp #$54 // T
beq cmdTest
done:
rts
// STID Commands
@ -166,9 +177,48 @@ stidExec: {
cmdReset:
jmp $fce2 // SYS 64738
cmdZeroPageInfo:
cmdSysInfo:
jsr System.toDebug
jmp done
cmdTest: {
// TODO: Optizime for code size here
ldy #1
loop:
tya
jsr clearVideo
jsr clearColors
jsr Timers.delayOne
iny
bne loop
VideoClearColorRam($03)
jmp done
clearVideo: {
ldx #0
!loop:
sta $0400, x
sta $0400 + $100, x
sta $0400 + $200, x
sta $0400 + $300, x
inx
bne !loop-
rts
}
clearColors: {
ldx #0
!loop:
sta $d800, x
sta $d800 + $100, x
sta $d800 + $200, x
sta $d800 + $300, x
inx
bne !loop-
rts
}
}
}
@ -362,7 +412,7 @@ helpString:
.byte $8e, 0
aboutString:
.text "woz64 mon - v 1.5.0"
.text "woz64 mon - v 1.6.0"
.byte $8e, 0
lineString:
.text "----------------------------------------"