paren_count = op2 last_line = op3 last_line_col = last_line + 2 getstr: xor a ld (paren_count),a ld c,a ;c = length counter ld (op1),a ;mode 0 = CAPS ld (last_line),ix ld a,(pencol) ld (last_line_col),a getstr1: ;ix = place to put string ;b = max legnth ld a,'I' ld (ix),a inc ix inc c push bc push ix bcall(_vputmap) pop ix pop bc call del push bc push ix bcall(_getcsc) pop ix pop bc or a jr z,getstr1 cp 09h jr z,donestr ;enter pressed cp 30h push af call z,next_keytable pop af jr z,getstr1 cp 38h push af call z,del ;del pressed pop af jr z,getstr1 ld e,a ld d,0 call get_keytable add hl,de ld a,(hl) or a jr z,getstr1 cp $28 jr nz,_ ld hl,paren_count inc (hl) _ cp $29 jr nz,_ ld hl,paren_count dec (hl) _ ld (ix+0),a inc ix inc c push bc push ix bcall(_vputmap) pop ix pop bc djnz getstr1 ret donestr: ld a,c or a jr z,getstr1 ;ya had to input SOMETHING! ld a,(paren_count) or a jr z,_ ld a,(penrow) add a,6 ld (penrow),a push bc call update_line_col pop bc ld (ix),$0A inc ix inc c ld (last_line),ix ld (last_line_col),a jp getstr1 _ xor a ld (ix+0),a inc c ;c ends up returning the total ;entered characters. ret ;done getting string del: ld a,c or a ret z ;nothing to delete! inc b ;one more to enter dec c ;one less entered dec ix ;decrement ptr ld a,(ix+0) ;here comes the fun part cp $28 jr nz,_ ld hl,paren_count dec (hl) _ cp $29 jr nz,_ ld hl,paren_count inc (hl) _ ld l,a ld h,0 add hl,hl ;a*2 add hl,hl ;a*4 add hl,hl ;a*8 push bc push ix bcall(_sfont_len) ;b = num pixels wide chr is ld d,b ;for some reason its b, not a (?) pop ix pop bc xor a ld (ix+0),a ld a,(pencol) sub d ;a - length ld (pencol),a push af push bc push ix ld b,d dec b del_loop: ld a,20h bcall(_vputmap) djnz del_loop pop ix pop bc pop af ld (pencol),a ret clear_all_input: call del ld a,c or a jr nz,clear_all_input ret get_keytable: push af ld a,(op1) ld hl,keytable_mini or a jr z,done_keytable_check ld hl,keytable_num dec a jr z,done_keytable_check done_keytable_check: pop af ret next_keytable: ld a,(op1) inc a cp 2 jr c,no_reset_keytable xor a no_reset_keytable: ld (op1),a ret keytable_mini: db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db $27 db 77h db 72h db 6Dh db 68h db 00h db 00h db 3Fh db 21h db 76h db 71h db 6Ch db 67h db 00h db 00h db 3Ah db 7Ah db 75h db 70h db 6Bh db 66h db 63h db 29h db 20h db 79h db 74h db 6Fh db 6Ah db 65h db 62h db 28h db 00h db 78h db 73h db 6Eh db 69h db 64h db 61h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h keytable_num: db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 2Bh ;+ db 2Dh ;- db 2Ah ;* db 2Fh ;/ db 5Eh ;^ db 00h db 00h db 3Fh ;? db 33h ;3 db 36h ;6 db 39h ;9 db 29h ;) db 00h db 00h db 00h db 2Eh ;. db 32h ;2 db 35h ;5 db 38h ;8 db 28h ;( db 00h db 00h db 29h ;) db 30h ;(space) db 31h ;1 db 34h ;4 db 37h ;7 db 2Ch ;, db 00h db 00h db 28h ;( db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h db 00h VPutS: PUSH AF PUSH DE PUSH IX VPutS10: LD A,(HL) ; get a character of string name INC HL OR A ; end of string? JR Z, VputS20 ; yes ---> bcall(_VPutMap) ; display one character of string JR NC, VPutS10 ; display rest of string IF FITS VputS20: POP IX POP DE POP AF RET update_line_col: ld b,0 push ix ulc_loop: dec ix ld a,(ix) cp $28 jr nz,_ inc b dec b jr z,found_last_open inc b _ cp $29 jr nz,_ dec b _ jp ulc_loop found_last_open: push ix pop de ld hl,(last_line) ld a,(last_line_col) line_col_loop: or a sbc hl,de add hl,de jr z,ulc_done push hl push af ld a,(hl) ld l,a ld h,0 add hl,hl ;a*2 add hl,hl ;a*4 add hl,hl ;a*8 push de bcall(_sfont_len) ;b = num pixels wide chr is pop de pop af add a,b ;for some reason its b, not a (?) inc hl jp line_col_loop ulc_done: add a,4 ld (pencol),a pop ix ret