Compare commits

...

3 Commits

Author SHA1 Message Date
Kelvin Sherlock dcbafc2999 commentary. 2022-01-30 15:52:38 -05:00
Kelvin Sherlock 80edada6e9 DECCOLM 132 support (partial).
I still don't support 132 mode but switching clears the screen, homes the cursor,
and clears any scrolling regions, so it's necessary for passing the vttest suite.
2022-01-30 15:52:32 -05:00
Kelvin Sherlock 04113c4725 Rom 1 _InstallCDA call clobbers some direct page locations.
This is fixed in ROM 3 (or via the TS patches if you boot GS/OS).
Workaround it by switching to DPAGE 0.

Also, allocate memory (since I originally thought that might be relevant).
2022-01-30 15:50:54 -05:00
5 changed files with 122 additions and 11 deletions

View File

@ -36,6 +36,7 @@ DECOM ds 2 ; origin
DECSCNM ds 2 ; screen mode DECSCNM ds 2 ; screen mode
DECAWM ds 2 ; wrap DECAWM ds 2 ; wrap
DECARM ds 2 ; auto repeat DECARM ds 2 ; auto repeat
DECCOLM ds 2 ; character per line (80/132)
LNM ds 2 ; new line LNM ds 2 ; new line
@ -46,7 +47,6 @@ SGR ds 2 ; graphics, bit 1 = bold, 4 = underscore, 5 = blink, 7 = inverse
*CHARSET ds 2 ; *CHARSET ds 2 ;
*GRAPHICS ds 2 ; *GRAPHICS ds 2 ;
*DECCOLM ds 2 ; character per line (80/132)
*DECINLM ds 2 ; interlace *DECINLM ds 2 ; interlace
*DECSCLM ds 2 ; scroll mode *DECSCLM ds 2 ; scroll mode
@ -93,6 +93,8 @@ read_q_tail ds 2
write_q_head ds 2 write_q_head ds 2
write_q_tail ds 2 write_q_tail ds 2
master_id ds 2
do *>256 do *>256
err "too big" err "too big"
fin fin

View File

@ -37,8 +37,20 @@ ptr ds 2
init_cda ent init_cda ent
php php
rep #$30 rep #$30
*
* rom 1 IIgs InstallCDA clobbers $3c-$43 on the direct page
*
phd
pea #0
pld
psl #handle psl #handle
_InstallCDA _InstallCDA
pld
plp plp
rts rts
@ -272,6 +284,7 @@ variables
jsr decawm jsr decawm
jsr decarm jsr decarm
jsr decscnm jsr decscnm
jsr deccolm
jsr lnm jsr lnm
jsr sgr jsr sgr
jsr dectm jsr dectm
@ -372,11 +385,22 @@ decscnm
:str asc "DECSCNM: ",00 :str asc "DECSCNM: ",00
lnm deccolm
mx %10 mx %10
ldy #line_12+4 ldy #line_12+4
ldx #:str ldx #:str
jsr print_xy_str jsr print_xy_str
lda DPAGE+DECCOLM
jmp print_on_off
:str asc "DECCOLM: ",00
lnm
mx %10
ldy #line_13+4
ldx #:str
jsr print_xy_str
lda DPAGE+LNM lda DPAGE+LNM
jmp print_on_off jmp print_on_off
@ -385,7 +409,7 @@ lnm
sgr sgr
mx %10 mx %10
ldy #line_13+4 ldy #line_14+4
ldx #:str ldx #:str
jsr print_xy_str jsr print_xy_str
lda DPAGE+SGR lda DPAGE+SGR
@ -396,7 +420,7 @@ sgr
dectm dectm
mx %10 mx %10
ldy #line_14+4 ldy #line_15+4
ldx #:str ldx #:str
jsr print_xy_str jsr print_xy_str
lda DPAGE+DECTM lda DPAGE+DECTM
@ -407,7 +431,7 @@ dectm
decbm decbm
mx %10 mx %10
ldy #line_15+4 ldy #line_16+4
ldx #:str ldx #:str
jsr print_xy_str jsr print_xy_str
lda DPAGE+DECBM lda DPAGE+DECBM
@ -419,7 +443,7 @@ decbm
decx decx
mx %10 mx %10
ldy #line_16+4 ldy #line_17+4
ldx #:str ldx #:str
jsr print_xy_str jsr print_xy_str
lda DPAGE+x lda DPAGE+x
@ -431,7 +455,7 @@ decx
decy decy
mx %10 mx %10
ldy #line_17+4 ldy #line_18+4
ldx #:str ldx #:str
jsr print_xy_str jsr print_xy_str
lda DPAGE+y lda DPAGE+y

View File

@ -354,7 +354,7 @@ mode_common
dw :rts ; error dw :rts ; error
dw mode_DECCKM dw mode_DECCKM
dw mode_DECANM dw mode_DECANM
dw :rts ; DECCOLM dw mode_DECCOLM ; DECCOLM
dw :rts ; DECSCLM dw :rts ; DECSCLM
dw mode_DECSCNM dw mode_DECSCNM
dw mode_DECOM dw mode_DECOM
@ -396,10 +396,33 @@ mode_DECANM
:rts rts :rts rts
*mode_DECCOLM mode_DECCOLM
* sty DECCOLM * 80/132 mode.
* rts * vt102 guide states:
* NOTE: When you change the number of columns per line, the screen is erased.
* This also sets the scrolling region for full screen (24 lines).
*
* based on testing, this always clears the screen and resets x/y, regardless of current mode.
*
bit pmod
bpl :rts
sty DECCOLM
lda #0
sta DECTM
lda #23
sta DECBM
stz x
stz y
phy
jsr recalc_cursor
jsr erase_screen_2
ply
:rts rts
mode_DECSCNM mode_DECSCNM
bit pmod bit pmod

View File

@ -60,6 +60,9 @@ keypress ent
sta KEYSTROBE sta KEYSTROBE
* if DECARM is clear, skip repeat characters. * if DECARM is clear, skip repeat characters.
*
* a REAL vt100 will never auto-repeat ESC, TAB, RETURN, or if Control is also pressed.
*
bit DECARM bit DECARM
bpl :arm bpl :arm
bit #kmRepeat bit #kmRepeat

View File

@ -4,6 +4,8 @@
xc xc
xc xc
tbx on ; qasm
mx %11 mx %11
use vt.equ use vt.equ
use apple2gs.equ use apple2gs.equ
@ -62,6 +64,9 @@ init
sta SETALTCHAR sta SETALTCHAR
rep #$30 rep #$30
jsr init_mem
ldx #254 ldx #254
:zloop stz 0,x :zloop stz 0,x
dex dex
@ -120,6 +125,60 @@ init
jsr init_cda jsr init_cda
rts rts
init_mem
*
* see prodos technote #27
*
* _InstallCDA uses the memory manager ; otherwise I wouldn't bother
* This is here to prevent MM from stomping on our memory.
*
mx %00
stz master_id
_TLStartUp
pha
_MMStartUp
pla
bcs :p8
rts
:p8
_MTStartUp
pea #0
pea #$1000
_GetNewID
pla
sta master_id
* bank 0
pha
pha
pea #$0000
pea #$b800
pei master_id
pea #$c013
pea #0000
pea #0800
_NewHandle
pla
pla
* bank 1
pha
pha
pea #$0000
pea #$b800
pei master_id
pea #$c013
pea #$0001
pea #$0800
_NewHandle
pla
pla
rts
reset ent reset ent
mx %11 mx %11
php php