mirror of
https://github.com/irmen/prog8.git
synced 2025-01-11 13:29:45 +00:00
tweak cx16 system init and reset to not reset Vera any more
uses new audio routine to silence the audio
This commit is contained in:
parent
c50c9ca545
commit
deea0b05cb
@ -435,7 +435,7 @@ internal class AssignmentAsmGen(private val program: PtProgram,
|
||||
require(it.type == DataType.UBYTE)
|
||||
val scopeName = (scope as PtNamedNode).scopedName
|
||||
val comparison = PtRpn(DataType.UBYTE, assign.position)
|
||||
comparison.addRpnNode(PtIdentifier("$scopeName.$leftvar", it.type, value.position))
|
||||
comparison.addRpnNode(PtIdentifier("$scopeName.$leftvar", it.leftType, value.position))
|
||||
comparison.addRpnNode(PtIdentifier("$scopeName.$rightvar", it.rightType, value.position))
|
||||
comparison.addRpnNode(PtRpnOperator(it.operator, it.type, it.leftType, it.rightType, it.position))
|
||||
comparison.parent = scope
|
||||
|
@ -394,6 +394,11 @@ romsub $ff53 = joystick_scan() clobbers(A, X, Y)
|
||||
romsub $ff56 = joystick_get(ubyte joynr @A) -> ubyte @A, ubyte @X, ubyte @Y
|
||||
romsub $ff56 = joystick_get2(ubyte joynr @A) clobbers(Y) -> uword @AX ; alternative to above to not have the hassle to deal with multiple return values
|
||||
|
||||
; Audio (bank 10)
|
||||
romsub $C09F = audio_init() -> ubyte @Pc ; (re)initialize PSG and YM audio chips
|
||||
; TODO: add more of the audio routines here.
|
||||
|
||||
|
||||
asmsub kbdbuf_clear() {
|
||||
; -- convenience helper routine to clear the keyboard buffer
|
||||
%asm {{
|
||||
@ -641,8 +646,9 @@ asmsub init_system() {
|
||||
lda VERA_DC_VIDEO
|
||||
and #%00000111 ; retain chroma + output mode
|
||||
sta P8ZP_SCRATCH_REG
|
||||
lda #$80
|
||||
sta VERA_CTRL ; reset vera
|
||||
lda #$0a
|
||||
sta $01 ; rom bank 10 (audio)
|
||||
jsr audio_init ; silence
|
||||
stz $01 ; rom bank 0 (kernal)
|
||||
jsr c64.IOINIT
|
||||
jsr c64.RESTOR
|
||||
@ -650,7 +656,7 @@ asmsub init_system() {
|
||||
lda VERA_DC_VIDEO
|
||||
and #%11111000
|
||||
ora P8ZP_SCRATCH_REG
|
||||
sta VERA_DC_VIDEO ; keep old output mode
|
||||
sta VERA_DC_VIDEO ; restore old output mode
|
||||
lda #$90 ; black
|
||||
jsr c64.CHROUT
|
||||
lda #1
|
||||
@ -907,8 +913,6 @@ sys {
|
||||
%asm {{
|
||||
sei
|
||||
stz $01 ; bank the kernal in
|
||||
lda #$80
|
||||
sta cx16.VERA_CTRL ; reset Vera (kernal doesn't do this?)
|
||||
jmp (cx16.RESET_VEC)
|
||||
}}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ while still being low level enough to create high performance programs.
|
||||
You can compile programs for various machines with this CPU:
|
||||
|
||||
* Commodore 64
|
||||
* Commander X16
|
||||
* Commander X16 (release R42 or newer is required)
|
||||
* Commodore 128 (limited support for now)
|
||||
* Atari 800 XL (limited support for now)
|
||||
|
||||
|
@ -159,7 +159,7 @@ And for the Commander X16::
|
||||
cx16.restore_irq() ; set everything back to the systems default irq handler
|
||||
|
||||
|
||||
The Commander X16 syslib provides two additional routines that should be used *in your IRQ handler routine* if it uses the Vera registers.
|
||||
The Commander X16 syslib does provides two additional routines that should be used *in your IRQ handler routine* if it uses the Vera registers.
|
||||
They take care of saving and restoring the Vera state of the interrupted main program, otherwise the IRQ handler's manipulation
|
||||
will corrupt any Vera operations that were going on in the main program. The routines are::
|
||||
|
||||
@ -168,7 +168,11 @@ will corrupt any Vera operations that were going on in the main program. The rou
|
||||
cx16.pop_vera_context()
|
||||
|
||||
.. caution::
|
||||
It is advised to not use floating point calculations inside IRQ handler routines.
|
||||
The Commander X16's 16 'virtual registers' R0-R15 are located in zeropage and *are not preserved* in the IRQ handler!
|
||||
So you should make sure that the handler routine does NOT use these registers, or do some sort of saving/restoring yourself
|
||||
of the ones that you do need in the IRQ handler.
|
||||
|
||||
It is also advised to not use floating point calculations inside IRQ handler routines.
|
||||
Beside them being very slow, there are intricate requirements such as having the
|
||||
correct ROM bank enabled to be able to successfully call them (and making sure the correct
|
||||
ROM bank is reset at the end of the handler), and the possibility
|
||||
|
@ -12,12 +12,9 @@ RPN: Fix the TODO RPN routines to be optimized assembly in RpnExpressionAsmGen.k
|
||||
RPN: check BinExprSplitter disablement any effect for RPN?
|
||||
RPN: Implement RPN codegen for IR.
|
||||
|
||||
- Move asmExtra vars into BSS as well, now are .byte 0 allocated
|
||||
|
||||
|
||||
For next minor release
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
- should X16 R0-R15 be saved in IRQ routine? At least document that you should not use them in IRQ handler?
|
||||
- Move asmExtra vars into BSS as well, now are .byte 0 allocated
|
||||
|
||||
...
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user