1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-02 08:30:55 +11:00

Compare commits

..

No commits in common. "f2817870aa4fa9cc215da15a852614d3e027a8b9" and "db9885b8cf51b302e3b4935a93f05690de0c9fa8" have entirely different histories.

23 changed files with 23 additions and 120 deletions

View File

@ -1,6 +1,6 @@
RAMSTART FUTURE USES +3c BLK(*
+02 CURRENT +3e FUTURE USES
+04 HERE
+02 CURRENT +3e XYPOS
+04 HERE +40 FUTURE USES
+06 C<? +51 CURRENTPTR
+08 C<* override +53 (emit) override
+0a NLPTR +55 (key) override

View File

@ -7,8 +7,8 @@ WORDBUF is the buffer used by WORD
BOOT C< PTR is used when Forth boots from in-memory
source. See "Initialization sequence" below.
XYPOS Current position of the cursor on screen. The meaning of
the pos in terms of row and cols is driver-dependent.

View File

@ -3,6 +3,7 @@
: HERE 0x04 RAM+ ;
: CURRENT* 0x51 RAM+ ;
: CURRENT CURRENT* @ ;
: XYPOS 0x40 RAM+ ;
( w -- a f )
: FIND CURRENT @ SWAP _find ;

View File

@ -1,10 +1,10 @@
( handle backspace: go back one char in IN>, if possible, then
emit BS + SPC + BS )
emit SPC + BS )
: (inbs)
( already at IN( ? )
IN> @ IN( = IF EXIT THEN
IN> @ 1- IN> !
BS SPC BS
SPC BS
;
: KEY

View File

@ -1,12 +1,12 @@
: (rdlnc) ( -- c )
: (rdlnc) ( -- f )
( buffer overflow? same as if we typed a newline )
IN> @ IN) = IF 0x0a ELSE KEY THEN ( c )
DUP 0x7f = IF DROP 0x8 THEN ( del? same as backspace )
DUP 0x0a = IF DROP 0xd THEN ( lf? same as cr )
( bacspace? handle and exit )
DUP 0x8 = IF (inbs) EXIT THEN
( echo back )
DUP EMIT ( c )
( bacspace? handle and exit )
DUP 0x8 = IF (inbs) EXIT THEN
( write and advance )
DUP ( keep as result ) ( c c )
( We take advantage of the fact that c's MSB is always zero and

View File

@ -1,3 +1,3 @@
Sega Master System Recipe
622 VDP 630 PAD
622 VDP

View File

@ -13,4 +13,4 @@ the screen is reached, we wrap up to the top.
When reaching a new line, we clear that line and the next to
help readability.
Load range: 623-628
Load range: 623-623

View File

@ -1,4 +1,3 @@
: XYPOS [ VDP_MEM LITN ] ;
CODE _ctl ( a -- sends LSB then MSB )
HL POPqq, chkPS,
A L LDrr, VDP_CTLPORT OUTnA,

17
blk/627
View File

@ -1,15 +1,6 @@
: _cell! ( tilenum pos )
2 * 0x7800 OR _ctl ( tilenum ) _data 1 _zero ;
: _spc! 0 ( blank ) XYPOS @ _cell! ;
: _lf
_spc! XYPOS @ [ VDP_COLS LITN ] / 1+ [ VDP_ROWS LITN ] MOD
[ VDP_COLS LITN ] * XYPOS ! ;
: _bs _spc! XYPOS @ 1-
[ VDP_COLS VDP_ROWS * LITN ] MOD XYPOS ! ;
: (emit)
DUP 0x08 = IF DROP _bs EXIT THEN
DUP 0x0d = IF DROP _lf EXIT THEN
0x20 - DUP 0< IF DROP EXIT THEN
0x5e MIN ( tilenum ) XYPOS @ _cell!
XYPOS @ 2 * 0x7800 OR _ctl
0x20 - 0x5e MIN ( tilenum ) _data 1 _zero
XYPOS @ 1+ DUP [ VDP_COLS VDP_ROWS * LITN ]
= IF DROP 0 THEN XYPOS ! ;
= IF DROP 0 THEN XYPOS !
;

View File

@ -6,5 +6,4 @@
( sprite, inverted colors ) 0x3f _data 15 _zero
0x4000 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont LOOP
0 XYPOS !
( bit 6, enable display, bit 7, ?? ) 0x81c0 _ctl
;

16
blk/630
View File

@ -1,16 +0,0 @@
Pad driver - read input from MD controller
Conveniently expose an API to read the status of a MD pad A.
Moreover, implement a mechanism to input arbitrary characters
from it. It goes as follow:
* Direction pad select characters. Up/Down move by one,
Left/Right move by 5
* Start acts like Return
* A acts like Backspace
* B changes "character class": lowercase, uppercase, numbers,
special chars. The space character is the first among special
chars.
* C confirms letter selection
(cont.)

View File

@ -1,6 +0,0 @@
This module is currently hard-wired to VDP driver, that is, it
calls vdp's routines during (key) to update character
selection.
Load range: 632-637

12
blk/632
View File

@ -1,12 +0,0 @@
: _prevstat [ PAD_MEM LITN ] ;
: _sel [ PAD_MEM 1+ LITN ] ;
: _next [ PAD_MEM 2+ LITN ] ;
( Put status for port A in register A. Bits, from MSB to LSB:
Start - A - C - B - Right - Left - Down - Up
Each bit is high when button is unpressed and low if button is
pressed. When no button is pressed, 0xff is returned.
This logic below is for the Genesis controller, which is modal.
TH is an output pin that swiches the meaning of TL and TR. When
TH is high (unselected), TL = Button B and TR = Button C. When
TH is low (selected), TL = Button A and TR = Start. )

15
blk/633
View File

@ -1,15 +0,0 @@
CODE _status
A 0b11111101 LDrn, ( TH output, unselected )
PAD_CTLPORT OUTnA,
PAD_D1PORT INAn,
0x3f ANDn, ( low 6 bits are good )
B A LDrr, ( let's store them )
( Start and A are returned when TH is selected, in bits 5 and
4. Well get them, left-shift them and integrate them to B. )
A 0b11011101 LDrn, ( TH output, selected )
PAD_CTLPORT OUTnA,
PAD_D1PORT INAn,
0b00110000 ANDn,
A SLAr, A SLAr, B ORr,
PUSHA,
;CODE

View File

@ -1,8 +0,0 @@
: _chk ( c --, check _sel range )
_sel C@ DUP 0x7f > IF 0x20 _sel C! THEN
0x20 < IF 0x7f _sel C! THEN ;
CREATE _ '0' C, ':' C, 'A' C, '[' C, 'a' C, 0xff C,
: _nxtcls
_sel @ _ BEGIN ( c a ) C@+ 2 PICK > UNTIL ( c a )
1- C@ SWAP DROP _sel !
;

13
blk/635
View File

@ -1,13 +0,0 @@
: _updsel ( -- f, has an action button been pressed? )
_status _prevstat C@ OVER = IF DROP 0 EXIT THEN
DUP _prevstat C! ( changed, update ) ( s )
0x01 ( UP ) OVER AND NOT IF 1 _sel +! THEN
0x02 ( DOWN ) OVER AND NOT IF -1 _sel +! THEN
0x04 ( LEFT ) OVER AND NOT IF -5 _sel +! THEN
0x08 ( RIGHT ) OVER AND NOT IF 5 _sel +! THEN
0x10 ( BUTB ) OVER AND NOT IF _nxtcls THEN
( update sel in VDP )
_chk _sel C@ (emit) -1 XYPOS +!
( return whether any of the high 3 bits is low )
0xe0 AND 0xe0 <
;

View File

@ -1,9 +0,0 @@
: (key)
_next C@ IF _next C@ 0 _next C! EXIT THEN
BEGIN _updsel UNTIL
_prevstat C@
0x20 ( BUTC ) OVER AND NOT IF DROP _sel C@ EXIT THEN
0x40 ( BUTA ) AND NOT IF 0x8 ( BS ) EXIT THEN
( If not BUTC or BUTA, it has to be START )
0xd _next C! _sel C@
;

View File

@ -1,2 +0,0 @@
: PAD$
0xff _prevstat C! 'a' _sel C! 0 _next C! ;

Binary file not shown.

View File

@ -7,9 +7,6 @@ all: $(TARGET)
$(TARGET): xcomp.fs $(STAGE)
cat xcomp.fs | $(STAGE) > $@
os.sms: $(TARGET)
dd if=$(TARGET) bs=32752 conv=sync | cat - sega.bin > $@
$(EMUL):
$(MAKE) -C ${@:%/sms=%}

Binary file not shown.

View File

@ -3,14 +3,10 @@
0xdd00 CONSTANT RS_ADDR
( Memory register at the end of RAM. Must not overwrite )
0xddca CONSTANT PS_ADDR
RAMSTART 0x70 + CONSTANT VDP_MEM
0xbf CONSTANT VDP_CTLPORT
0xbe CONSTANT VDP_DATAPORT
32 CONSTANT VDP_COLS
24 CONSTANT VDP_ROWS
RAMSTART 0x72 + CONSTANT PAD_MEM
0x3f CONSTANT PAD_CTLPORT
0xdc CONSTANT PAD_D1PORT
212 LOAD ( z80 assembler )
: ZFILL, ( u ) 0 DO 0 A, LOOP ;
262 LOAD ( xcomp )
@ -26,11 +22,11 @@ CURRENT @ XCURRENT !
393 LOAD ( xcomp core low )
CREATE ~FNT CPFNT7x7
623 628 LOADR ( VDP )
632 637 LOADR ( PAD )
: (key) 4 ;
420 LOAD ( xcomp core high )
(entry) _
( Update LATEST )
PC ORG @ 8 + !
," VDP$ PAD$ " EOT,
," VDP$ " EOT,
ORG @ 0x100 - 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!

View File

@ -19,7 +19,8 @@ emul: $(EMUL) $(TARGET)
$(EMUL) $(TARGET)
os.rom: $(TARGET)
dd if=$(TARGET) bs=1M of=$@ conv=sync
cp $(TARGET) $@
truncate -s 1M $@
os.8xu: os.rom
$(MKTIUPGRADE) -p -k keys/0A.key -d TI-84+ os.rom $@ 00