atexit.register(deinit)
tty.setraw(fd_in)
# auto wrap off, hide cursor, reset attributes
- if not hrcg:
- write('\x1b[?7l\x1b[?25l\x1b[0m')
+ write('\x1b[?7l\x1b[?25l\x1b[0m')
def deinit():
global termios_attr
# reset to initial state, auto wrap on, show cursor, reset attributes
# note: reset to initial state clears the screen which I do not like,
# but it may be the only way to clear our change to the beep settings
- if not hrcg:
- #write('\x1bc\x1b[?7h\x1b[?25h\x1b[0m')
- write('\x1b[?7h\x1b[?25h\x1b[0m')
+ #write('\x1bc\x1b[?7h\x1b[?25h\x1b[0m')
+ write('\x1b[?7h\x1b[?25h\x1b[0m')
termios.tcsetattr(fd_in, termios.TCSADRAIN, termios_attr)
atexit.unregister(deinit)
global ch_in
if len(ch_in) == 0:
+ write('\x1b[?25h') # show cursor
get_internal()
+ write('\x1b[?25l') # hide cursor
ch = ch_in
ch_in = ''
mem[HW_IOADR] &= 0x7f
return ch
def input():
+ global ch_in
+
write('\x1b[?25h') # show cursor
line = ''
while True:
- ch = get()
+ # taken from get(), but doesn't do cursor
+ if len(ch_in) == 0:
+ get_internal()
+ ch = ch_in
+ ch_in = ''
+ mem[HW_IOADR] &= 0x7f
+
if ch == '\b':
if len(line):
_print('\b')
else:
_print(ch)
if ch == '\r':
- write('\x1b[?25l') # hide cursor
- return line
- else:
- if len(line) >= 247:
- _print('\a')
- if len(line) >= 255:
- _print('\r')
- line = ''
- continue
- line += ch
+ break
+ if len(line) >= 247:
+ _print('\a')
+ if len(line) >= 255:
+ _print('\r')
+ line = ''
+ continue
+ line += ch
+ write('\x1b[?25l') # hide cursor
+ return line
def htab(x):
low_mem[ZP_CH] = (x - 1) & 0xff
#!/bin/sh
-../applesoft_basic.py --hrcg --joystick=/dev/input/event19,flip_y,swap_buttons ../ribbit/ribbit_patched.tok |\
+../applesoft_basic.py --hrcg --joystick=/dev/input/by-id/usb-Madcatz_Mad_Catz_V.1_Stick-event-joystick,flip_y,swap_buttons ../ribbit/ribbit_patched.tok |\
./emu_65c02 monitor_rom.obj hrcg.obj terminal.obj
wndbtm equ $23
ch equ $24
cv equ $25
+gbasl equ $26
+gbash equ $27
+cursor equ $fb
prevch equ $fc
state equ $fd
prevnum equ $fe
hrcg equ $8dff
hrcgent equ hrcg+3 avoids banner
extfont equ hrcg+7
+hirespg equ hrcg+$62
font equ hrcg-$600 hard coded 2 sets
kbd equ $c000
kbdstrb equ $c010
s.exit equ $c0f8
dos.lo equ $c0f9
dos.hi equ $c0fa
+gbascalc equ $f847
cout equ $fded
org $800
lda #0
lda #<font
sta extfont+1
jsr hrcgent
+ ldx #0
+ stx cursor
lda #$d cr
sta prevch
- ldx #0
newst stx state
loop lda sout.s
bpl nosout
dex
beq state2
dex
- bne notst3
- jmp state3
-notst3 lda #1
+ beq state3
+ dex
+ bne notst4
+ jmp state4
+notst4 dex
+ bne notst5
+ jmp state5
+notst5 lda #1
sta s.exit
state0 cmp #4 ctrl-d
bne notctld
cpy #$d but only after cr
bne notctld
stx num use num as linebuf index
- ldx #3
+ ldx #5
jmp newst
notctld cmp #$1b esc
bne notesc
inx
jmp newst
notesc sta prevch
+ jsr togcsr
+ lda prevch
ora #$80
jsr cout
+ jsr togcsr
jmp loop
state1 cmp #$5b [
- bne newst invalid escape sequence
+ bne newst0 invalid escape sequence
stx prevnum
stx num
ldx #2
- jmp newst
-state2 cmp #$30 0
- bcc newst invalid escape sequence
+newst0 jmp newst
+state2 cmp #$3f ?
+ bne notqm
+ ldx #4
+ jmp newst1
+notqm ldy #3
+ sty state
+state3 cmp #$30 0
+ bcc newst1 invalid escape sequence
cmp #$3a
- bcs notdig
- sec
- sbc #$30 digit value
- asl num
- clc
- adc num + num * 2
- asl num
- asl num
- clc
- adc num + num * 8
- sta num to num
- jmp loop
-notdig cmp #$3b ;
+ bcc digit
+ cmp #$3b ;
bne notscln
lda num
sta prevnum
notscln cmp #$47 G
bne notch
dec num
+ jsr togcsr
lda num
sta ch
- jmp newst
+ jsr togcsr
+ ldx #0
+newst1 jmp newst
notch cmp #$64 d
bne notcv
dec num
+ jsr togcsr
lda num
sta cv
+ jsr togcsr
+ ldx #0
jmp newst
notcv cmp #$72 r
- bne notwnd
+ bne newst2
dec prevnum
lda prevnum
sta wndtop
lda num
sta wndbtm
-notwnd jmp newst invalid escape sequence
-state3 ldy num
+newst2 jmp newst invalid escape sequence
+state4 cmp #$30 0
+ bcc newst3 invalid escape sequence
+ cmp #$3a
+ bcs notdig
+digit sec
+ sbc #$30 digit value
+ asl num
+ clc
+ adc num + num * 2
+ asl num
+ asl num
+ clc
+ adc num + num * 8
+ sta num to num
+ jmp loop
+notdig cmp #$6c l
+ beq setprv
+ cmp #$68 h
+ bne newst3 invalid escape sequence
+setprv ldy num
+ cpy #25 esc [?25l or esc [?25h
+ bne newst3
+ pha
+ jsr togcsr
+ pla
+ ldy #0
+ cmp #$6c l
+ beq setcur
+ ldy #$80
+setcur sty cursor
+ jsr togcsr
+ ldx #0
+newst3 jmp newst
+state5 ldy num
cmp #$d
bne notcr
txa
iny
sty num
jmp loop
+togcsr bit cursor
+ bpl rts0
+ lda cv
+ jsr gbascalc
+ lda gbash
+ ora #$1c 7th line of the cell
+ ora hirespg inside hrcg, $20 or $40
+ sta gbash
+ ldy ch
+ lda (gbasl),y
+ eor #$7f
+ sta (gbasl),y
+rts0 rts
--- ribbit.bas 2022-05-25 17:46:21.340258050 +1000
-+++ ribbit_patched.bas 2022-05-25 18:05:19.116303909 +1000
++++ ribbit_patched.bas 2022-05-25 21:41:23.001127447 +1000
@@ -1,6 +1,7 @@
10GOTO10000:REM INITIALIZE
20GOSUB900:GOTO1000
1340IF(FY=BY-1ORFY=BY-2)ANDFX>BX-12ANDFX<BX-5THENVTABBY:HTABBX:PRINTBUG$(0,0):BC=1:BX=1:FS=FS+1:GOSUB2000:GOSUB800
1350RETURN
2000REM SCORE
-@@ -138,9 +139,10 @@
+@@ -92,6 +93,7 @@
+ 10090POKEADRS+7,CL:POKEADRS+8,CH:CALLADRS+3:REM INIT HRCG
+ 10100PRINTCHR$(16):REM CLEAR SCREEN
+ 10200REM PICTURES
++10210DIMBUG$(1,2),FROG$(1,4),RBT$(1,5)
+ 10300BUG$(0,0)="\ 2 \ 3 \ 4"
+ 10310BUG$(0,1)="\ 2\ 11&'*\ 3():\ 4"
+ 10320BUG$(0,2)="\ 2\ 11 !#\ 3 $%\ 4"
+@@ -138,9 +140,10 @@
20100PRINTIB$;IC$;IP$;"\13HI! \13WELCOME TO...\v"
20110VTAB10:PRINT"\13DO YOU KNOW HOW TO PLAY THIS GAME?\v"
20120PRINTIA$;IT$;:VTAB1:HTAB1:PRINT" ";
20230VTABFY:HTABFX+2:PRINTFROG$(1,1)
20240FORI=1TO100:NEXT:NEXT
20250FORI=1TO1000:NEXT:VTABFY:HTABFX:PRINTIP$;FROG$(0,1)
-@@ -160,6 +162,7 @@
+@@ -160,6 +163,7 @@
20410FX=FX-1:VTABFY:HTABFX:PRINTFROG$(0,3);
20420I=FY:FORFY=ITO18
20430FX=FX-1:VTABFY:HTABFX:PRINTFROG$(0,4);