Skip to content

Commit

Permalink
Add NSETEOL & change behaviour of NINPUT/NPRINT.
Browse files Browse the repository at this point in the history
  • Loading branch information
TechCowboy committed Mar 26, 2023
1 parent b227b29 commit ec9b66e
Show file tree
Hide file tree
Showing 15 changed files with 446 additions and 78 deletions.
Binary file modified apple2/FUJIAPPLE
Binary file not shown.
Binary file modified apple2/dist/FUJIAPPLE.po
Binary file not shown.
Binary file modified apple2/dist/FUJIAPPLE_clean.po
Binary file not shown.
21 changes: 21 additions & 0 deletions apple2/examples/ATARI_LOOP_TEST.BAS.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
NEW

500 DIM A$(8),B$(8),F(1),S(1,9),H$(64),D$(64)

540 PRINT "HOSTNAME OR TO LISTEN"
REM 550 INPUT H$
550 H$="192.168.2.212"
570 D$="N:TCP://":D$(LEN(D$)+1)=H$:D$(LEN(D$)+1)=":6502/"
580 PRINT "OPENING "; D$
600 OPEN #2,12,0,D$

700 B$="TESTING": C=0
710 C = C + 1

800 PRINT #2;B$:PRINT ">";B$;C

900 INPUT #2,A$:PRINT "<";A$

1000 GOTO 710

SAVE "D:LOOPTEST.BAS"
28 changes: 28 additions & 0 deletions apple2/examples/CLOCK.BAS.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

10 GOSUB 10000
20 &NTIME YR,MO,DY,HR,MN,S
30 PRINT "FUJI TIME:";Y;" ";MO;" ";D;" ";
40 PRINT H;":";M;".";S
50 END


REM *******************************************
REM DETERMINE IF FUJI EXTENSIONS ARE INSTALLED
REM *******************************************
10000 GOSUB 10030: IF R=1 THEN PRINT "EXTENSIONS ALREADY INSTALLED.": RETURN
10010 PRINT "LOADING EXTENSIONS..."
10020 PRINT CHR$ (4);"BRUN /FUJI.APPLE/FUJIAPPLE":RETURN

10030 X = PEEK(1014)+PEEK(1015)*256
10040 X = X - 1
10050 C = PEEK(X)
10060 IF C = 0 OR C > 20 THEN 10140
10070 X = X - C
10080 A$=""
10090 FOR Y = 1 TO C: A$=A$+CHR$(PEEK(X)):X=X+1:NEXT Y
10100 B$ = "FUJIAMP"
10130 IF A$=B$ THEN R=1: GOTO 10150
10140 R=0
10150 RETURN

SAVE /FUJI.APPLE/CLOCK.BAS
52 changes: 52 additions & 0 deletions apple2/examples/SETEOL.BAS.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

10 GOSUB 10000
REM START AS A HOST
100 HOME
119 D$="N:TCP://"+H$+":6502/": PRINT "OPENING ";D$

200 & NOPEN N0,12,0,D$
210 PRINT "WAITING FOR CONNECTION..."
220 W$="/-\-|-":W=1
230 & NSTATUS N0,BW,CN,ER
240 PRINT MID$(W$,W,1);CHR$(8);
250 W=W+1:IF W>6 THEN W=1
260 IF CN = 0 THEN 230

300 PRINT "ACCEPTED CONNECTION.": &NACCEPT N0

REM SET TO ATARI EOL CHARACTER
310 &NSETEOL 155
320 C = 0
330 A$="COUNT: "+STR$(C)
340 &NPRINT 0, A$
350 C = C + 1

400 &NINPUT 0, B$
410 PRINT B$

500 IF C < 100 THEN 330

600 &NCLOSE 0



REM *******************************************
REM DETERMINE IF FUJI EXTENSIONS ARE INSTALLED
REM *******************************************
10000 GOSUB 10030: IF R=1 THEN PRINT "EXTENSIONS ALREADY INSTALLED.": RETURN
10010 PRINT "LOADING EXTENSIONS..."
10020 PRINT CHR$ (4);"BRUN /FUJI.APPLE/FUJIAPPLE":RETURN

10030 X = PEEK(1014)+PEEK(1015)*256
10040 X = X - 1
10050 C = PEEK(X)
10060 IF C = 0 OR C > 20 THEN 10140
10070 X = X - C
10080 A$=""
10090 FOR Y = 1 TO C: A$=A$+CHR$(PEEK(X)):X=X+1:NEXT Y
10100 B$ = "FUJIAMP"
10130 IF A$=B$ THEN R=1: GOTO 10150
10140 R=0
10150 RETURN

SAVE /FUJI.APPLE/SETEOL.BAS
5 changes: 3 additions & 2 deletions apple2/src/APPLEEQU.S
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
SPACE = $A0 ; SPACE CHARACTER FOR COUT
COLON = ':'+$80 ; COLON CHARACTER FOR COUT
POUND = '#'+$80 ; HASH SIGN FOR COUT
CR = $0D ; CARRIAGE RETURN
SEMICOLON = ';' ; ASCII SEMICOLON CHARACTER
CR = $0D ; ASCII CARRIAGE RETURN
QUOTE = '"' ; ASCII QUOTE CHARACTER

FRESPC = $71 ; Applesoft pointer at the string storage area, used when a new string is created.
AMPVECT = $03F5 ; AMPERSAND VECTOR FOR APPLESOFT
Expand Down Expand Up @@ -47,7 +49,6 @@ SETNORM = $FE84 ; SET NORMAL
TOK_READ = 135 ; APPLESOFT TOKEN FOR READ
TOK_AT = 197 ; APPLESOFT TOKEN FOR AT
TOK_END = 128 ; APPLESOFT TOKEN FOR END
QUOTE = $22 ; ASCII QUOTE CHARACTER
TOK_LIST = 188 ; APPLESOFT TOKEN FOR LIST
TOK_TRACE = 155 ; APPLESOFT TOKEN FOR TRACE
TOK_NOTRACE = 156 ; APPLESOFT TOKEN FOR NOTRACE
Expand Down
129 changes: 108 additions & 21 deletions apple2/src/FAKESMARTPORT.S
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FN_STATUS_FLAG_NOT_CONNECTED = %11111101

.IF .NOT USE_SP

NUMBER_OF_FAKE_UNITS = 4
NUMBER_OF_FAKE_UNITS = 11

;*******************************
; FIND_SMARTPORT_SLOT
Expand Down Expand Up @@ -59,6 +59,9 @@ GET_SMARTPORT_DISPATCH_ADDRESS:

; THIS IS JUST FOR TESTING WITH AN EMULATOR




;******************************************************************
; FAKE_DISPATCHER
; Simulates dispatcher calls so we can test in an emulator
Expand Down Expand Up @@ -93,6 +96,7 @@ SRC_STR = ZP4
SRC_STR_LO = ZP4_LO
SRC_STR_HI = ZP4_HI

UNIT_FN_CLOCK = 9

FAKE_DISPATCHER:
LDX #$00
Expand Down Expand Up @@ -151,9 +155,16 @@ SAVE_ZP:
LDA (ZCMD_LIST),Y ; NWD CONFIRMED CORRECT
STA ZPAYLOAD_HI ; WHERE TO STORE RESULT

.IF EXT3_TRACE
LDA REQUESTED_UNIT
LDX REQUESTED_CMD
JSR PRTAX
JSR CROUT
.ENDIF

LDA REQUESTED_CMD
CMP #SP_CMD_STATUS
BNE CHECK_READ_CMD
BNE CHECK_READ_CMD_

; ***********************
; SP_CMD_STATUS
Expand All @@ -172,62 +183,131 @@ SAVE_ZP:
LDY #4
LDA (ZCMD_LIST),Y
CMP #SP_STATUS_CODE
BNE COMPLETE_CMD_ ; DON'T KNOW WHAT TO DO...
BNE COMPLETE_CMD_

LDY #$00
LDA #NUMBER_OF_FAKE_UNITS
STA (ZPAYLOAD),Y
CLC
BCC COMPLETE_CMD_


NON_SMARTPORT_CTRLR:
; LDA REQUESTED_UNIT
CMP #1
BNE NETWORK_DEV0
FUJI_DISK1: ; UNIT 1 - FUJINET DISK 0
CMP #5
BPL NETWORK_DEV0

;---------------------------------------------------------------------------------
FUJI_DISK1: ; UNIT 1 - 4 FUJINET DISK 0-3
SEC
SBC #$01 ; SUBSTRACT 1 FROM UNIT NUMBER
CLC
ADC #'0' ; CONVERT TO ASCII

LDX DISK_STR_WITH_NUMBER_INDEX
STA FUJI_DISK_0_STR,X

LDA FUJI_DISK_0_STR_ADDR
LDY FUJI_DISK_0_STR_ADDR+1
LDX FUJI_DISK_0_STR_LEN
CLC
BCC COPY_2_PAYLOAD_2
BCC COPY_2_PAYLOAD_3

COMPLETE_CMD_:
BCC COMPLETE_CMD_4

NETWORK_DEV0: ; UNIT 2 - NETWORK
; LDA REQUESTED_UNIT
CMP #$02
CMP #$05
BNE NETWORK_1_AND_UP
;---------------------------------------------------------------------------------

LDA NETWORK_STR_ADDR
LDY NETWORK_STR_ADDR+1
LDX NETWORK_STR_LEN

CLC
BCC COPY_2_PAYLOAD_2
BCC COPY_2_PAYLOAD_3

NETWORK_1_AND_UP:
; LDA REQUESTED_UNIT
CMP #$05
BPL COMPLETE_CMD_
; LDA REQUESTED_UNIT 5,6,7
CMP #UNIT_FN_CLOCK
BPL FN_CLOCK_

TAX
DEX ; UNIT 3/4 = NETWORK_1/2
DEX
TXA
;---------------------------------------------------------------------------------
SEC
SBC #$05 ; SUBTRACT 6 FROM THE UNIT REQUESTED
CLC
ADC #'0'
ADC #'0' ; CONVERT TO ASCII

LDX NETWORK_STR_WITH_NUMBER_INDEX
STA NETWORK_STR_WITH_NUMBER,X

LDA NETWORK_STR_WITH_NUMBER_ADDR
LDY NETWORK_STR_WITH_NUMBER_ADDR+1
LDX NETWORK_STR_WITH_NUMBER_LEN
CLC
COPY_2_PAYLOAD_3:
BCC COPY_2_PAYLOAD_2
CHECK_READ_CMD_:
BCC CHECK_READ_CMD
FN_CLOCK_:
CMP #UNIT_FN_CLOCK
BNE FN_CPM

;---------------------------------------------------------------------------------
LDY #4
LDA (ZCMD_LIST),Y
CMP #'T'
BNE CLOCK_NAME
REQUEST_TIME:
LDY #$00 ; SET THE CLOCK TO 1/2/3 4:5.6
SET_CLOCK:
TYA
STA (ZPAYLOAD),Y
INY
CPY #7
BNE SET_CLOCK
CLC
BCC COMPLETE_CMD_
CLOCK_NAME:
LDA CLOCK_STR_ADDR
LDY CLOCK_STR_ADDR+1
LDX CLOCK_STR_LEN
CLC
BCC COPY_2_PAYLOAD_2
COMPLETE_CMD_4:
BCC COMPLETE_CMD_3
FN_CPM:
CMP #$0A
BNE FN_PRINTER

;---------------------------------------------------------------------------------
LDA CPM_STR_ADDR
LDY CPM_STR_ADDR+1
LDX CPM_STR_LEN
CLC
BCC COPY_2_PAYLOAD_2

FN_PRINTER:
CMP #$0B
BNE COMPLETE_CMD_3

;---------------------------------------------------------------------------------
LDA PRINTER_STR_ADDR
LDY PRINTER_STR_ADDR+1
LDX PRINTER_STR_LEN
CLC
BCC COPY_2_PAYLOAD_2


CHECK_READ_CMD:
LDA REQUESTED_CMD
CMP #SP_CMD_READ
BNE CHECK_WRITE_CMD

;---------------------------------------------------------------------------------

; ***********************
; SP_CMD_READ
; ***********************
Expand All @@ -253,15 +333,17 @@ COPY_2_PAYLOAD_2:
CLC
BCC COPY_2_PAYLOAD


COMPLETE_CMD_:
CLC
COMPLETE_CMD_3:
BCC COMPLETE_CMD_2


CHECK_WRITE_CMD:
; LDA REQUESTED_CMD
CMP #SP_CMD_WRITE
BNE CHECK_CONTROL

;---------------------------------------------------------------------------------
; ***********************
; SP_CMD_WRITE
; ***********************
Expand All @@ -271,6 +353,11 @@ CHECK_WRITE_CMD:
;2-3 data buffer pointer
;4-5 byte count
;6-7 address pointer

.IF EXT3_TRACE
JSR DUMP_SP_PAYLOAD
.ENDIF

CLC
BCC COMPLETE_CMD_2

Expand Down Expand Up @@ -317,15 +404,15 @@ NO_OPENED_FILES:

NO_OPENED_FILES2:
; TODO: SAVE FLAGS
COMPLETE_CMD_2:
CLC
BCC COMPLETE_CMD_2
BCC COMPLETE_CMD


CTRL_R:
CMP #'R'
BNE CTRL_W

COMPLETE_CMD_2:
CLC
BCC COMPLETE_CMD

Expand Down
Loading

0 comments on commit ec9b66e

Please sign in to comment.