Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 33 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
SYS8K=2400
SYS16K=8192
SYS32K=20480

GRPHKBD=-DKEYBOARD=\"GRPHKBD\"
BUISKBD=-DKEYBOARD=\"BUISKBD\"
8296KBD=-DKEYBOARD=\"8296KBD\"

default:
dasm petterm.s -DBASIC -f1 -obuild/petterm.prg -lbuild/petterm.lst
cls
dasm petterm.s -DGRPHKBD=1 ${GRPHKBD} -DBASIC -f1 -obuild/petterm.prg -lbuild/petterm.lst

all:
dasm petterm.s -f1 -obuild/petterm40G.prg -lbuild/petterm40G.lst
dasm petterm.s -DCOL80 -f1 -obuild/petterm80G.prg -lbuild/petterm80G.lst
dasm petterm.s -DBUISKBD -f1 -obuild/petterm40B.prg -lbuild/petterm40B.lst
dasm petterm.s -DBUISKBD -DCOL80 -f1 -obuild/petterm80B.prg -lbuild/petterm80B.lst
dasm petterm.s ${GRPHKBD} -f1 -obuild/petterm40G.prg -lbuild/petterm40G.lst
dasm petterm.s ${GRPHKBD} -DCOL80 -f1 -obuild/petterm80G.prg -lbuild/petterm80G.lst
dasm petterm.s ${BUISKBD} -f1 -obuild/petterm40B.prg -lbuild/petterm40B.lst
dasm petterm.s ${BUISKBD} -DCOL80 -f1 -obuild/petterm80B.prg -lbuild/petterm80B.lst
dasm petterm.s ${8296KBD} -DCOL80 -f1 -obuild/petterm8296.prg -lbuild/petterm8296.lst

basic:
$(info )
Expand All @@ -18,19 +25,24 @@ basic:
$(info *********** 32K HIMEM : SYS ${SYS32K} ***********)
$(info **********************************************)
$(info )
dasm petterm.s -DBASIC -f1 -obuild/petterm40G.prg -lbuild/petterm40G.lst
dasm petterm.s -DBASIC -DCOL80 -f1 -obuild/petterm80G.prg -lbuild/petterm80G.lst
dasm petterm.s -DBASIC -DBUISKBD -f1 -obuild/petterm40B.prg -lbuild/petterm40B.lst
dasm petterm.s -DBASIC -DBUISKBD -DCOL80 -f1 -obuild/petterm80B.prg -lbuild/petterm80B.lst
dasm petterm.s -DBASIC -DHIMEM -DMEM8K -f1 -obuild/petterm8K_40G.prg -lbuild/petterm8K_40G.lst
dasm petterm.s -DBASIC -DCOL80 -DHIMEM -DMEM8K -f1 -obuild/petterm8K_80G.prg -lbuild/petterm8K_80G.lst
dasm petterm.s -DBASIC -DBUISKBD -DHIMEM -DMEM8K -f1 -obuild/petterm8K_40B.prg -lbuild/petterm8K_40B.lst
dasm petterm.s -DBASIC -DBUISKBD -DCOL80 -DHIMEM -DMEM8K -f1 -obuild/petterm8K_80B.prg -lbuild/petterm8K_80B.lst
dasm petterm.s -DBASIC -DHIMEM -DMEM16K -f1 -obuild/petterm16K_40G.prg -lbuild/petterm16K_40G.lst
dasm petterm.s -DBASIC -DCOL80 -DHIMEM -DMEM16K -f1 -obuild/petterm16K_80G.prg -lbuild/petterm16K_80G.lst
dasm petterm.s -DBASIC -DBUISKBD -DHIMEM -DMEM16K -f1 -obuild/petterm16K_40B.prg -lbuild/petterm16K_40B.lst
dasm petterm.s -DBASIC -DBUISKBD -DCOL80 -DHIMEM -DMEM16K -f1 -obuild/petterm16K_80B.prg -lbuild/petterm16K_80B.lst
dasm petterm.s -DBASIC -DHIMEM -DMEM32K -f1 -obuild/petterm32K_40G.prg -lbuild/petterm32K_40G.lst
dasm petterm.s -DBASIC -DCOL80 -DHIMEM -DMEM32K -f1 -obuild/petterm32K_80G.prg -lbuild/petterm32K_80G.lst
dasm petterm.s -DBASIC -DBUISKBD -DHIMEM -DMEM32K -f1 -obuild/petterm32K_40B.prg -lbuild/petterm32K_40B.lst
dasm petterm.s -DBASIC -DBUISKBD -DCOL80 -DHIMEM -DMEM32K -f1 -obuild/petterm32K_80B.prg -lbuild/petterm32K_80B.lst
dasm petterm.s -DBASIC ${GRPHKBD} -f1 -obuild/petterm40G.prg -lbuild/petterm40G.lst
dasm petterm.s -DBASIC ${GRPHKBD} -DCOL80 -f1 -obuild/petterm80G.prg -lbuild/petterm80G.lst
dasm petterm.s -DBASIC ${BUISKBD} -f1 -obuild/petterm40B.prg -lbuild/petterm40B.lst
dasm petterm.s -DBASIC ${BUISKBD} -DCOL80 -f1 -obuild/petterm80B.prg -lbuild/petterm80B.lst
dasm petterm.s -DBASIC ${GRPHKBD} -DHIMEM -DMEM8K -f1 -obuild/petterm8K_40G.prg -lbuild/petterm8K_40G.lst
dasm petterm.s -DBASIC ${GRPHKBD} -DCOL80 -DHIMEM -DMEM8K -f1 -obuild/petterm8K_80G.prg -lbuild/petterm8K_80G.lst
dasm petterm.s -DBASIC ${BUISKBD} -DHIMEM -DMEM8K -f1 -obuild/petterm8K_40B.prg -lbuild/petterm8K_40B.lst
dasm petterm.s -DBASIC ${BUISKBD} -DCOL80 -DHIMEM -DMEM8K -f1 -obuild/petterm8K_80B.prg -lbuild/petterm8K_80B.lst
dasm petterm.s -DBASIC ${GRPHKBD} -DHIMEM -DMEM16K -f1 -obuild/petterm16K_40G.prg -lbuild/petterm16K_40G.lst
dasm petterm.s -DBASIC ${GRPHKBD} -DCOL80 -DHIMEM -DMEM16K -f1 -obuild/petterm16K_80G.prg -lbuild/petterm16K_80G.lst
dasm petterm.s -DBASIC ${BUISKBD} -DHIMEM -DMEM16K -f1 -obuild/petterm16K_40B.prg -lbuild/petterm16K_40B.lst
dasm petterm.s -DBASIC ${BUISKBD} -DCOL80 -DHIMEM -DMEM16K -f1 -obuild/petterm16K_80B.prg -lbuild/petterm16K_80B.lst
dasm petterm.s -DBASIC ${GRPHKBD} -DHIMEM -DMEM32K -f1 -obuild/petterm32K_40G.prg -lbuild/petterm32K_40G.lst
dasm petterm.s -DBASIC ${GRPHKBD} -DCOL80 -DHIMEM -DMEM32K -f1 -obuild/petterm32K_80G.prg -lbuild/petterm32K_80G.lst
dasm petterm.s -DBASIC ${BUISKBD} -DHIMEM -DMEM32K -f1 -obuild/petterm32K_40B.prg -lbuild/petterm32K_40B.lst
dasm petterm.s -DBASIC ${BUISKBD} -DCOL80 -DHIMEM -DMEM32K -f1 -obuild/petterm32K_80B.prg -lbuild/petterm32K_80B.lst
dasm petterm.s -DBASIC ${8296KBD} -DCOL80 -DHIMEM -DMEM32K -f1 -obuild/petterm8296B.prg -lbuild/petterm8296B.lst

clean:
del build\*.prg
del build\*.lst
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ The original PETTERM without the BASIC save/load extension
- petterm40B - 40 column PETs with business keyboard
- petterm80G - 80 column PETs with graphics keyboard
- petterm80B - 80 column PETs with business keyboard
- petterm8296 - 80 column PET 8296

Basic:

Expand All @@ -110,6 +111,7 @@ The higher memory versions with the BASIC save/load extension
- petterm32K_80G.prg - 80 column PETs with graphics keyboard, BASIC save/load, higher memory version (SYS 24576)
- petterm32K_40B.prg - 40 column PETs with business keyboard, BASIC save/load, higher memory version (SYS 24576)
- petterm32K_80B.prg - 80 column PETs with business keyboard, BASIC save/load, higher memory version (SYS 24576)
- petterm8296B.prg - PET 8296, BASIC save/load, higher memory version (SYS 24576) (not tested)

PRG files are the native programs, can be added to a tape or disk image

Expand Down
72 changes: 59 additions & 13 deletions kbd.s
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ KBDROWSETUP SUBROUTINE ;6;
STA KBITFND ;3; If KBITFND clear at end of polling then no key pressed
RTS ;6

; If a key way pressed in the polling convert to a scancode
; If a key was pressed in the polling convert to a scancode
; Returns pressed key or 0
; 90 cycles worst case
KBDROWCONV SUBROUTINE ;6;
Expand Down Expand Up @@ -191,7 +191,7 @@ KBDPOLL SUBROUTINE


; A log2 table allows quick decoding by giving the index of the highest bit set
; Remembering that modifers need to be checked seperatly
; Remembering that modifers need to be checked separately
; This table is inverted due to our key tables being backwards
; 7 - LOG_2(x)
LOG2_TBL DC.B -1,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4
Expand All @@ -212,8 +212,15 @@ LOG2_TBL DC.B -1,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4
; $F3 = RIGHT
; $F4 = LEFT
;

ECHO "Keyboard Type =",KEYBOARD


KBDMATRIX
IFCONST BUISKBD

IF KEYBOARD == "BUISKBD"
ECHO "Compiling for Business Keyboards"

; Matrix for Business Keyboards
KR0 DC.B '. ,$0E,$F3,'8 ,'- ,'8 ,'5 ,'2 ;$8E = BothShift+2, $1D = CursRight
KR1 DC.B '9 ,$EF,'^ ,'7 ,'0 ,'7 ,'4 ,'1
Expand Down Expand Up @@ -247,11 +254,12 @@ SKR6 DC.B '3 ,$00,$19,'. ,'> ,'B ,'C ,$00 ; $AE-> KP.
SKR7 DC.B '2 ,$04,$0F,'0 ,'< ,'N ,'V ,'Z ; Repeat->^D, $0F = Z+A+L??
SKR8 DC.B '1 ,'? ,$15,$F0,'M ,' ,'X ,$FF ; $15 - RVS + A + L??, B1 = KP1
SKR9 DC.B $16,$EF,'* ,$83,') ,'& ,'# ,$08 ; $88 Left Arrow to BS?, ^V=TAB+<-+DEL




ELSE
ENDIF


IF KEYBOARD == "GRPHKBD"
ECHO "Compiling for Graphics Keyboards"

; Matrix for Graphics keyboards
KR0 DC.B $F3,$F0,$5F, '(, '&, '%, '#, '!
KR1 DC.B $08,$F2,$EF, '), '\, '', '$, '" ;" ; (Appease the syntax highlighter)
Expand Down Expand Up @@ -290,9 +298,47 @@ SKR9 DC.B '=, '.,$EF,$03, '<, ' , '{,$FF
ENDIF


IF KEYBOARD == "8296KBD"
ECHO "Compiling for PET 8296 Keyboard"

; Matrix for PET 8296 English keyboards
KR0 DC.B '. ,$0E,$F3,'8 ,'- ,'8 ,'5 ,'2 ;$8E = BothShift+2, $1D = CursRight
KR1 DC.B '9 ,$EF,'^ ,'7 ,'0 ,'7 ,'4 ,'1
KR2 DC.B '5 ,'; ,'k ,'] ,'h ,'f ,'s ,$1B ; $9B = ESC
KR3 DC.B '6 ,'@ ,'l ,$0D,'j ,'g ,'d ,'a
KR4 DC.B $08,'p ,'i ,'\ ,'y ,'r ,'w ,$09 ;$C0 = nonshiftable @, $FF= nonshift DEL
KR5 DC.B '4 ,'[ ,'o ,$F2,'u ,'t ,'e ,'q ; $91 = CursUP
KR6 DC.B '3 ,$00,$19,'. ,'. ,'b ,'c ,$00 ; $AE-> KP.
KR7 DC.B '2 ,$04,$0F,'0 ,$2C,'n ,'v ,'z ; Repeat->^D, $0F = Z+A+L??
KR8 DC.B '1 ,'/ ,$15,$F0,'m ,' ,'x ,$FF ; $15 - RVS + A + L??, B1 = KP1
KR9 DC.B $16,$EF,': ,$03,'9 ,'6 ,'3 ,$08 ; $88 Left Arrow to BS?, ^V=TAB+<-+DEL

; Keymasks to remove modifers from the scan results
; There are backward of the table above! Above goes from 9->0, these are 0->9
KEYMASK DC.B $FF,$BF,$FF,$FF,$FF,$FF,$BE,$FF,$FE,$BF
; Which bits indicate shift keys
SHIFTMASK DC.B $00,$00,$00,$00,$00,$00,$41,$00,$00,$00
; Which bits indicate ctrl keys
CTRLMASK DC.B $00,$00,$00,$00,$00,$00,$00,$00,$01,$00

; Keyboard matrix with shift pressed, needed for consistent shifts
; Matrix for PET 8296 Keyboard
KBDMATRIX_SHIFT
SKR0 DC.B '> ,$0E,$F4,'8 ,'= ,'( ,'% ,'" ;";$8E = BothShift+2, $9D = CursRight
SKR1 DC.B '9 ,$EF,'| ,'7 ,'0 ,$27,'$ ,'!
SKR2 DC.B '5 ,'+ ,'K ,'} ,'H ,'F ,'S ,$1B ; $1B = ESC
SKR3 DC.B '6 ,'~ ,'L ,$0D,'J ,'G ,'D ,'A
SKR4 DC.B $08,'P ,'I ,'\ ,'Y ,'R ,'W ,$09 ;$C0 = nonshiftable @, $FF= nonshift DEL
SKR5 DC.B '4 ,'{ ,'O ,$F1,'U ,'T ,'E ,'Q ; $91 = CursUP
SKR6 DC.B '3 ,$00,$19,'. ,'> ,'B ,'C ,$00 ; $AE-> KP.
SKR7 DC.B '2 ,$04,$0F,'0 ,'< ,'N ,'V ,'Z ; Repeat->^D, $0F = Z+A+L??
SKR8 DC.B '1 ,'? ,$15,$F0,'M ,' ,'X ,$FF ; $15 - RVS + A + L??, B1 = KP1
SKR9 DC.B $16,$EF,'* ,$83,') ,'& ,'# ,$08 ; $88 Left Arrow to BS?, ^V=TAB+<-+DEL
ENDIF


; Custom keys for graphic keyboards
; Shift + [] = {}
; Shift + ' = `
; Shift + @ = ~
; Shift + ^ (up arrow) = |
; Custom keys for graphic and 8296 keyboards (ASCII values)
; Shift + [] = {} 123 125
; Shift + ' = ` 96
; Shift + @ = ~ 126
; Shift + ^ (up arrow) = | 124
7 changes: 6 additions & 1 deletion menu.s
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,13 @@ DOMENU SUBROUTINE

; 0123456789012345678901234567890123456789
S_BANNER
DC.B "PETTERM v0.7.0 CHARTREUSE - 2020",13,10
DC.B "PETTERM v0.7.1 CHARTREUSE - 2020",13,10
DC.B "--------------------+ K0FFY 2022",13,10

IF KEYBOARD == "8296KBD"
DC.B " + SCHEMA 2022",13,10
ENDIF

DC.B " +------------------",13,10,10,0
S_MENU
DC.B "[1] DECREASE BAUD RATE",13,10,10
Expand Down
6 changes: 5 additions & 1 deletion petterm.s
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;-----------------------------------------------------------------------
; PETTerm
; Version 0.7.0
; Version 0.7.1
;
; A bit-banged full duplex serial terminal for the PET 2001 computers,
; including those running BASIC 1.
Expand Down Expand Up @@ -182,6 +182,10 @@
; It is currently written to use XMODEM-CRC, for which each block contains 128 bytes
; of data with a 16-bit CRC at the end.
;
; 0.7.1
;
; PET 8296 Keyboard Support by Leif Bloomquist (Schema) - 2022
;
;
; Written for the DASM assembler
;-----------------------------------------------------------------------
Expand Down