Skip to content

Commit

Permalink
Merge branch 'update-altirraos-3.39' into port-3ds
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed Jul 3, 2023
2 parents abeb945 + f61ff6e commit a712fa9
Show file tree
Hide file tree
Showing 17 changed files with 1,843 additions and 1,765 deletions.
4 changes: 3 additions & 1 deletion emuos/main.xasm
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ gpdvv PBI_VECTOR_TABLE ;$E48F XL/XE: Generic device vector
icl 'keytable.s'
_KERNEL_REPORT_MODULE_SIZE 'Keyboard routines', 0

.if _KERNEL_XLXE
.ifdef _KERNEL_816
.echo 'Free space: ', $FFE4-*, ' bytes'
.elif _KERNEL_XLXE
.echo 'Free space: ', $FFEE-*, ' bytes'
.else
.echo 'Free space: ', $FFFA-*, ' bytes'
Expand Down
4 changes: 2 additions & 2 deletions emuos/src/bootscreen.s
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,9 @@ split:
dta $9b

.ifdef _KERNEL_816
dta d"Copyright (C) 2018-2022 Avery Lee",$9b
dta d"Copyright (C) 2018-2023 Avery Lee",$9b
.else
dta d"Copyright (C) 2012-2022 Avery Lee",$9b
dta d"Copyright (C) 2012-2023 Avery Lee",$9b
.endif

dta d"All Rights Reserved",$9b
Expand Down
8 changes: 6 additions & 2 deletions emuos/src/cio.s
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ iocb_loop:
; A = depends on operation
; X = IOCB offset (# x 16)
; Y = status (reflected in P)
; P = set based on status (guaranteed by OS Manual)
;
; Notes:
; BUFADR must not be touched from CIO. DOS XE relies on this for
Expand All @@ -55,14 +56,16 @@ xit:
ldx icidno
tya
sta icsta,x
php

.if _KERNEL_XLXE
mva #0 hndlod
.endif

lda ciochr
plp

;set NZ condition codes based on status
;C=1 needed by GUNDISK.XEX
cpy #0
rts

process:
Expand Down Expand Up @@ -671,6 +674,7 @@ cmd_tab:
mwa dvstat+2 loadad
ldx icidno
mva icax4,x ddevic
clc
jsr PHLoadHandler
bcs fail

Expand Down
13 changes: 4 additions & 9 deletions emuos/src/editor.s
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ special_code_tab:
dta $fe
dta $ff
special_code_tab_end:
dta $9b ;these are only for the K: check
dta $7c
dta $9b ;this is only for the K: check
special_code_tab_end_2:

;----------------
Expand Down Expand Up @@ -425,7 +424,9 @@ sbks_wrap:

;----------------
special_bell:
jmp EditorBell
.def :EditorBell
ldy #0
jmp Bell

;----------------
special_set_tab:
Expand Down Expand Up @@ -985,12 +986,6 @@ found:
rts
.endp

;==========================================================================
.proc EditorBell
ldy #0
jmp Bell
.endp

;==========================================================================
.proc EditorSwapToScreen_Y1
ldy #1
Expand Down
2 changes: 1 addition & 1 deletion emuos/src/init.s
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ krpdel_table:
ldy #6
and #$0e
bne is_ntsc
sne:inx
inx
dey
is_ntsc:
stx palnts
Expand Down
13 changes: 11 additions & 2 deletions emuos/src/init816.s
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ notRAM:
dta $00
.endp

krpdel_table:
dta 48,40

;==============================================================================
.proc InitEnvironment
mva tramsz ramsiz
Expand Down Expand Up @@ -348,9 +351,15 @@ init_done:
;set PAL/NTSC flag (XL/XE only)
ldx #0
lda pal
ldy #6
and #$0e
sne:inx
stx palnts
bne is_ntsc
inx
dey
is_ntsc:
stx palnts ;$00 for NTSC, $01 for PAL
sty keyrep ;6 for NTSC, 5 for PAL
mva krpdel_table,x krpdel

; 11. set misc database values
mva tramsz memtop+1
Expand Down
6 changes: 6 additions & 0 deletions emuos/src/kerneldb.inc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ pdmsk = $0249 ;PBI device interrupt mask (XL/XE)
reladr = $024a ;Relocating loader: temp address (XL/XE)
; $024b

; $024e ;Reserved by 1450XLD Parallel Disk Drive handler
; $024f ;Reserved by 1450XLD Parallel Disk Drive handler
; $0250 ;Reserved by 1400XL T: handler and 1450XLD PDD
; $0251 ;Reserved by 1400XL T: handler
; $0263-026a ;Reserved by 1400XL V: handler

.if _KERNEL_816
vabte = $024f ;(816) Emulation ABORT vector
; $0250
Expand Down
24 changes: 14 additions & 10 deletions emuos/src/keyboard.s
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ KeyboardClose = CIOExitSuccess
; lock if no lock is enabled and disable it otherwise.
; - Shift/Control lock is applied by K:, but only on alpha keys.
; - Inverse mode is also applied by K:. Control characters are excluded:
; 1B-1F/7C-7F/9B-9F/FD-FF.
; 1B-1F/7D-7F/9B-9F/FD-FF.
; - Any Ctrl+Shift key code (>=$C0) produces a key click but is otherwise
; ignored.
;
Expand Down Expand Up @@ -80,8 +80,8 @@ waitForChar2:

;do keyboard click (we do this even for ignored ctrl+shift+keys)
.if _KERNEL_XLXE
bit noclik
bmi no_click
ldy noclik
bne no_click
.endif

ldy #12
Expand All @@ -91,11 +91,7 @@ no_click:
;ignore char if both ctrl and shift are pressed
cmp #$c0
bcs waitForChar

;trap Ctrl-3 and return EOF
cmp #$9a
beq isCtrl3


;translate char
tay

Expand All @@ -114,6 +110,7 @@ no_click:
bcc toggle_shift ;$82 - caps lock
cmp #$85
bcc shift_ctrl_on ;$83 - shift caps lock / $84 - ctrl caps lock
beq isCtrl3 ;$85 - EOF

valid_key:
;check for alpha key
Expand Down Expand Up @@ -188,15 +185,22 @@ KeyboardSpecial = CIOExitNotSupported
lda kbcode

.if _KERNEL_XLXE
;save key
pha

;check for HELP
and #$3f
cmp #$11
bne not_help

;restore HELP key with original modifiers
pla
sta helpfg
beq xit2
bne xit2

not_help:
lda kbcode
;restore key
pla
.endif

;check if it is the same as the prev key
Expand Down
25 changes: 15 additions & 10 deletions emuos/src/keyboard816.s
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,18 @@ waitForChar2:

;do keyboard click (we do this even for ignored ctrl+shift+keys)
.if _KERNEL_XLXE
bit noclik
bmi no_click
ldy noclik
bne no_click
.endif

ldy #12
jsr Bell
no_click:

;ignore char if both ctrl and shift are pressed
cmp #$c0
bcs waitForChar

;trap Ctrl-3 and return EOF
cmp #$9a
beq isCtrl3


;translate char
tay
lda (keydef),y
Expand All @@ -103,6 +100,7 @@ no_click:
bcc toggle_shift ;$82 - caps lock
cmp #$85
bcc shift_ctrl_on ;$83 - shift caps lock / $84 - ctrl caps lock
beq isCtrl3 ;$85 - EOF

valid_key:
;check for alpha key
Expand Down Expand Up @@ -167,20 +165,27 @@ KeyboardSpecial = CIOExitNotSupported
;
.proc KeyboardIRQ
;reset software repeat timer
mva #$30 srtimr
mva krpdel srtimr

;read new key
lda kbcode

;save key
pha

;check for HELP
and #$3f
cmp #$11
bne not_help

;restore HELP key with original modifiers
pla
sta helpfg
beq xit2
bne xit2

not_help:
lda kbcode
;restore key
pla

;check if it is the same as the prev key
cmp ch1
Expand Down
55 changes: 30 additions & 25 deletions emuos/src/keytable.s
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,44 @@
; without any warranty.

KeyCodeToATASCIITable:
;Special codes in this table (values important for compat):
;The values in this table must match the Atari OS definitions for
;compatibility with programs that modify KEYDEF. The special codes
;are publicly defined in the XL Addendum, of which we currently use a
;subset:
;
; $80 - invalid key
; $81 - inverse video
; $82 - caps lock
; $83 - shift caps lock
; $84 - control caps lock
; $85 - EOF (Ctrl+3)

;lowercase
dta $6C, $6A, $3B, $80, $80, $6B, $2B, $2A
dta $6F, $80, $70, $75, $9B, $69, $2D, $3D
dta $76, $80, $63, $80, $80, $62, $78, $7A
dta $34, $80, $33, $36, $1B, $35, $32, $31
dta $2C, $20, $2E, $6E, $80, $6D, $2F, $81
dta $72, $80, $65, $79, $7F, $74, $77, $71
dta $39, $80, $30, $37, $7E, $38, $3C, $3E
dta $66, $68, $64, $80, $82, $67, $73, $61
dta $6C, $6A, $3B, $80, $80, $6B, $2B, $2A ;L J ;: F1 F2 K +\ *^
dta $6F, $80, $70, $75, $9B, $69, $2D, $3D ;O P U Ret I -_ =|
dta $76, $80, $63, $80, $80, $62, $78, $7A ;V Hlp C F3 F4 B X Z
dta $34, $80, $33, $36, $1B, $35, $32, $31 ;4$ 3# 6& Esc 5% 2" 1!
dta $2C, $20, $2E, $6E, $80, $6D, $2F, $81 ;,[ Spc .] N M /? Inv
dta $72, $80, $65, $79, $7F, $74, $77, $71 ;R E Y Tab T W Q
dta $39, $80, $30, $37, $7E, $38, $3C, $3E ;9( 0) 7' Bks 8@ < >
dta $66, $68, $64, $80, $82, $67, $73, $61 ;F H D Cps G S A

;SHIFT
dta $4C, $4A, $3A, $80, $80, $4B, $5C, $5E
dta $4F, $80, $50, $55, $9B, $49, $5F, $7C
dta $56, $80, $43, $80, $80, $42, $58, $5A
dta $24, $80, $23, $26, $1B, $25, $22, $21
dta $5B, $20, $5D, $4E, $80, $4D, $3F, $80
dta $52, $80, $45, $59, $9F, $54, $57, $51
dta $28, $80, $29, $27, $9C, $40, $7D, $9D
dta $46, $48, $44, $80, $83, $47, $53, $41
dta $4C, $4A, $3A, $80, $80, $4B, $5C, $5E ;L J ;: F1 F2 K +\ *^
dta $4F, $80, $50, $55, $9B, $49, $5F, $7C ;O P U Ret I -_ =|
dta $56, $80, $43, $80, $80, $42, $58, $5A ;V Hlp C F3 F4 B X Z
dta $24, $80, $23, $26, $1B, $25, $22, $21 ;4$ 3# 6& Esc 5% 2" 1!
dta $5B, $20, $5D, $4E, $80, $4D, $3F, $80 ;,[ Spc .] N M /? Inv
dta $52, $80, $45, $59, $9F, $54, $57, $51 ;R E Y Tab T W Q
dta $28, $80, $29, $27, $9C, $40, $7D, $9D ;9( 0) 7' Bks 8@ < >
dta $46, $48, $44, $80, $83, $47, $53, $41 ;F H D Cps G S A

;CTRL
dta $0C, $0A, $7B, $80, $80, $0B, $1E, $1F
dta $0F, $80, $10, $15, $9B, $09, $1C, $1D
dta $16, $80, $03, $80, $80, $02, $18, $1A
dta $80, $80, $9B, $80, $1B, $80, $FD, $80
dta $00, $20, $60, $0E, $80, $0D, $80, $80
dta $12, $80, $05, $19, $9E, $14, $17, $11
dta $80, $80, $80, $80, $FE, $80, $7D, $FF
dta $06, $08, $04, $80, $84, $07, $13, $01
dta $0C, $0A, $7B, $80, $80, $0B, $1E, $1F ;L J ;: F1 F2 K +\ *^
dta $0F, $80, $10, $15, $9B, $09, $1C, $1D ;O P U Ret I -_ =|
dta $16, $80, $03, $80, $80, $02, $18, $1A ;V Hlp C F3 F4 B X Z
dta $80, $80, $85, $80, $1B, $80, $FD, $80 ;4$ 3# 6& Esc 5% 2" 1!
dta $00, $20, $60, $0E, $80, $0D, $80, $80 ;,[ Spc .] N M /? Inv
dta $12, $80, $05, $19, $9E, $14, $17, $11 ;R E Y Tab T W Q
dta $80, $80, $80, $80, $FE, $80, $7D, $FF ;9( 0) 7' Bks 8@ < >
dta $06, $08, $04, $80, $84, $07, $13, $01 ;F H D Cps G S A
16 changes: 8 additions & 8 deletions emuos/src/screen.s
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,15 @@ clear_parms:
eor gprior
sta gprior

;if a GTIA mode is active or we're in mode 0, force off split mode
cmp #$40
;if a GTIA mode is active, force off split mode
;if we're in mode 0, force off the no-clear flag (per OS Manual p.57)
cmp #$40 ;test for GTIA mode and store in carry
txa ;test for GR.0
beq is_gr0 ;disable split screen and no-clear for GR.0

lda icax1z
bcs kill_split
cpx #0
bne not_gtia_mode_or_gr0
kill_split:
and #$ef
not_gtia_mode_or_gr0:
scc:and #$ef ;disable split screen for GTIA mode
is_gr0:

;save off the split screen and clear flags in a more convenient form
asl
Expand Down
Loading

0 comments on commit a712fa9

Please sign in to comment.