Skip to content

Commit

Permalink
Explicitely annotate 65C816 code with address & index width
Browse files Browse the repository at this point in the history
  • Loading branch information
Fulgen301 authored and mooinglemur committed Mar 1, 2024
1 parent 343b0f7 commit cd27e9a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions kernal/cbm/editor.s
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ scrorg php
.pushcpu
.setcpu "65816"
sep #$20
.A8
pha
lda $02,S
and #4
Expand Down
2 changes: 1 addition & 1 deletion kernal/cbm/memory.s
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ iobase php

.pushcpu
.setcpu "65816"

sep #$20
.A8
pha
lda $02,S
and #4
Expand Down
7 changes: 7 additions & 0 deletions kernal/drivers/x16/65c816/interrupt.s
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ c816_abort_native:
jmp (inabort)

.segment "MEMDRV"
.A8
.I8
__irq_65c816_first:
xba
pha
Expand Down Expand Up @@ -161,6 +163,8 @@ __interrupt_65c816_native_ret:
xce ; exit emulation mode
__interrupt_65c816_native_kernal_impl_ret:
rep #$31 ; 16-bit accumulator, clear carry
.A16
.I16
pla ; pull old stack pointer
tcs ; restore stack pointer
ply
Expand All @@ -169,6 +173,8 @@ __interrupt_65c816_native_kernal_impl_ret:
rti

nnnmi:
.A16
.I16
sec
xce
.A8
Expand All @@ -180,6 +186,7 @@ nnnmi:
nncop:
nnabort:
sep #$20
.A8
jmp nncop_abort_ret

.popcpu
Expand Down
10 changes: 10 additions & 0 deletions kernal/drivers/x16/65c816/stack.s
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ stack_one: .res 1
.segment "MACHINE"

.proc stack_init
.A8
.I8
lda #$01
sta stack_one
rts
Expand All @@ -31,6 +33,8 @@ stack_one: .res 1
; Output:
;--------------------------------------------------------------
.proc stack_push
.A16
.I16
ply
lda stack_counter
beq @counter_zero
Expand Down Expand Up @@ -58,6 +62,8 @@ stack_one: .res 1
.endproc

.proc stack_pop
.A16
.I16
ply
lda stack_counter
dec
Expand All @@ -81,10 +87,14 @@ stack_one: .res 1
.endproc

.proc stack_enter_kernal_stack
.A16
.I16
lda stack_ptr
jmp stack_push
.endproc

.proc stack_leave_kernal_stack
.A16
.I16
jmp stack_pop
.endproc
4 changes: 4 additions & 0 deletions kernal/drivers/x16/memory.s
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ __irq:

.pushcpu
.setcpu "65816"
.A8
.I8

.segment "KRAM816"
.export __irq_65c816_saved
Expand Down Expand Up @@ -429,6 +431,8 @@ __irq_ret:
.segment "KRAM816B"
.pushcpu
.setcpu "65816"
.A8
.I8

necop:
neabort:
Expand Down

0 comments on commit cd27e9a

Please sign in to comment.