diff --git a/ROMs/FORTH103.ROM b/ROMs/FORTH103.ROM new file mode 100644 index 0000000..e31a8c6 Binary files /dev/null and b/ROMs/FORTH103.ROM differ diff --git a/auxmem.bytwrd.s b/auxmem.bytwrd.s index 8cd695d..e94c79c 100644 --- a/auxmem.bytwrd.s +++ b/auxmem.bytwrd.s @@ -1,5 +1,5 @@ * AUXMEM.BYTWRD.S -* (c) Bobbi 2021 GPLv3 +* (c) Bobbi 2021,2022 GPLv3 * * Applecorn OSBYTE and OSWORD handlers * @@ -266,8 +266,8 @@ WORD00 IF MAXLEN-OSTEXT-2 BPL :WORD00LP3 ; 4 = MAXCHAR INY ; Initial line length = zero FIN + CLI ; Set IRQs going again STY FXLINES ; Reset line counter - CLI ; Ensure IRQs are on BEQ :WORD00LP ; Enter main loop :WORD00BELL LDA #$07 ; $07=BELL @@ -328,24 +328,24 @@ WORD00 IF MAXLEN-OSTEXT-2 ************************************ * On entry, (OSCTRL)=>control block * Y=0 -* IRQs are disabled while we access the timers +* IRQs are disabled while we access the timers and main memory -WORD01 STA RDMAINRAM ; Read from main memory +WORD01 STA RDMAINRAM ; Read from main mem (IRQs are off) :WORD01LP LDA SYSCLOCK,Y ; Read sys clock in main mem - STA (OSCTRL),Y ; Store in buffer + STA (OSCTRL),Y ; Store in buffer in aux mem INY CPY #$05 BCC :WORD01LP - STA RDCARDRAM ; Read from aux memory + STA RDCARDRAM ; Reads back to aux memory RTS -WORD02 >>> WRTMAIN -:WORD02LP LDA (OSCTRL),Y ; Read from buffer +WORD02 STA WRMAINRAM ; Write to main mem (IRQs are off) +:WORD02LP LDA (OSCTRL),Y ; Read from buffer in aux mem STA SYSCLOCK,Y ; Store to sys clock in main mem INY CPY #$05 BCC :WORD02LP - >>> WRTAUX + STA WRCARDRAM ; Writes back to aux memory RTS WORD03 @@ -359,35 +359,46 @@ WORD04 RTS ; Dummy, do nothing * Y=0, A=(OSCTRL) * IRQs are disabled, so we don't have to preserve IRQ state * -WORD05 JSR GETADDR ; Point to address, set Y=>data - BNE WORD05A - JSR WORD05IO - LDY #$04 - STA (OSCTRL),Y ; Store it -WORD05RET RTS - -WORD05IO LDA OSINTWS+0 ; X CORRUPTED BY XF2MAIN - LDY OSINTWS+1 -WORD05IO1 >>> XF2MAIN,MAINRDMEM - -* <8000xxxx language memory -* ????xxxx main memory RAM paged in via STA RDMAINRAM -* ????xxxx main memory ROM paged in via XFER - - STA RDMAINRAM ; Switch to main memory -WORD05A LDA (OSINTWS) ; Get byte - STA RDCARDRAM ; Back to aux memory +* <8000xxxx language memory - aux memory +* FFxxxxxx I/O memory - aux memory +* A0xxxxxx use this to specify 'A'pple main memory +* +WORD05 JSR GETADDR ; Point to address, set Y=>data byte + BEQ WORD5A ; Skip to read from main memory + LDA (OSINTWS) ; Get byte STA (OSCTRL),Y ; Store it RTS -WORD06 JSR GETADDR ; Point to address, set Y=>data +* We want to read from anywhere in main memory. We can't just set +* 'all reads from main' as we'd page out our own code. We need to call +* mainmem and read from there. +WORD5A JSR WORD05IO ; Call as a subroutine to return here + STA (OSCTRL),Y ; Store it + RTS + +WORD05IO LDA OSINTWS+0 ; X CORRUPTED BY XF2MAIN + LDY OSINTWS+1 ; &YYAA=address to read +WORD05IO1 >>> XF2MAIN,MAINRDMEM + +WORD06 JSR GETADDR ; Point to address, set Y=>data byte PHP - LDA (OSCTRL),Y ; Get byte + LDA (OSCTRL),Y ; Get byte from our memory PLP - BNE WORD06A - STA WRMAINRAM ; Switch to main memory -WORD06A STA (OSINTWS) ; Store it - STA WRCARDRAM ; Back to aux memory + BEQ WORD06A ; Skip to write to main memory + STA (OSINTWS) ; Store it + RTS + +* We want to be able to write to anywhere in main memory. +* As we are within the OSWORD handler, IRQs are off, so we can just +* 'write through' all memory. +WORD06A STA $C008 ; &0000-&01FF writes to main memory + STA WRMAINRAM ; &0200-&BFFF writes to main memory +* ; &C000-&CFFF is always I/O +* ; &D000-&FFFF how do we write to this? + STA (OSINTWS) ; Store it + STA $C009 ; &0000-&01FF writes to aux memory + STA WRCARDRAM ; &0200-&BFFF writes to aux memory +* ; &D000-&FFFF RTS GETADDR STA OSINTWS+0 ; (OSINTWS)=>byte to read/write @@ -398,7 +409,7 @@ GETADDR STA OSINTWS+0 ; (OSINTWS)=>byte to read/write INY LDA (OSCTRL),Y ; Get address high byte INY ; Point Y to data byte - CMP #$80 ; *TO DO* Needs an appropriate value + CMP #$A0 ; Let's use A0xxxxxx for 'A'pple memory RTS diff --git a/auxmem.chario.s b/auxmem.chario.s index b2a85df..11bffa5 100644 --- a/auxmem.chario.s +++ b/auxmem.chario.s @@ -445,7 +445,7 @@ ESCPOLL9 BIT ESCFLAG ; Return with Escape state RTS * Process pending Escape state -BYTE7E STA KBDACK ; Flush keyboard +BYTE7E STA KBDACK ; Flush keyboard LDX #$00 ; $7E = ack detection of ESC BIT ESCFLAG BPL BYTE7DOK ; No Escape pending diff --git a/auxmem.init.s b/auxmem.init.s index 18cf9c8..353cc19 100644 --- a/auxmem.init.s +++ b/auxmem.init.s @@ -9,17 +9,13 @@ MAXROM EQU $F9 ; Max sideways ROM number -* -* $90-$9f are spare Econet space so safe to use -* -ZP1 EQU $90 +ZP1 EQU $90 ; $90-$9f are spare Econet space + ; so safe to use ZP2 EQU $92 ZP3 EQU $94 -TEMP32 EQU $96 ; $96-$99 inclusive - -STRTBCKL EQU $9D ; *TO DO* No longer needed to preserve -STRTBCKH EQU $9E +*STRTBCKL EQU $9D ; *TO DO* No longer needed to preserve +*STRTBCKH EQU $9E MOSSHIM ORG AUXMOS ; MOS shim implementation @@ -111,7 +107,7 @@ MOSINIT SEI ; Ensure IRQs disabled :S8 STA SET80VID ; 80 col on STA CLRALTCHAR ; Alt charset off STA PAGE2 ; PAGE2 -* JMP MOSHIGH ; Ensure executing in high memory here + JMP MOSHIGH ; Ensure executing in high memory here MOSHIGH SEI ; Ensure IRQs disabled LDX #$FF @@ -169,11 +165,10 @@ BYTE8E PHP ; Save CLC=RESET, SEC=Not RESET ********************************* * X=service call, Y=parameter * -SERVICE TAX ; Enter here with A=Service Num +* SERVICE TAX ; Enter here with A=Service Num BYTE8F -SERVICEX LDA $F4 +SERVICEX LDA $F4 ; Enter here with X=Service Number PHA ; Save current ROM - *DEBUG LDA $E0 AND #$20 ; Test debug *OPT255,32 @@ -182,7 +177,7 @@ SERVICEX LDA $F4 BEQ :SERVDONE ; If debug on, ignore SERV06 :SERVDEBUG *DEBUG - TXA + TXA ; A=service number LDX MAXROM ; Start at highest ROM :SERVLP JSR ROMSELECT ; Bring it into memory BIT $8006 @@ -207,13 +202,13 @@ PRHELLO LDX #four byte zero page locations * Y= number of digits to pad to, 0 for no padding * -PRINTDEC STY OSPAD ; Number of padding+digits - LDY #0 ; Digit counter -PRDECDIGIT LDA #32 ; 32-bit divide - STA OSTEMP - LDA #0 ; Remainder=0 - CLV ; V=0 means div result = 0 -PRDECDIV10 CMP #10/2 ; Calculate OSNUM/10 - BCC PRDEC10 - SBC #10/2+$80 ; Remove digit & set V=1 to show div result > 0 - SEC ; Shift 1 into div result -PRDEC10 ROL 0,X ; Shift /10 result into OSNUM - ROL 1,X - ROL 2,X - ROL 3,X - ROL A ; Shift bits of input into acc (input mod 10) - DEC OSTEMP - BNE PRDECDIV10 ; Continue 32-bit divide - ORA #48 - PHA ; Push low digit 0-9 to print - INY - BVS PRDECDIGIT ; If V=1, result of /10 was > 0 & do next digit - LDA #32 -PRDECLP1 CPY OSPAD - BCS PRDECLP2 ; Enough padding pushed - PHA ; Push leading space characters - INY - BNE PRDECLP1 -PRDECLP2 PLA ; Pop character left to right - JSR OSWRCH ; Print it - DEY - BNE PRDECLP2 - RTS +PRINTDEC sty OSPAD ; Number of padding+digits + ldy #0 ; Digit counter +PRDECDIGIT lda #32 ; 32-bit divide + sta OSTEMP + lda #0 ; Remainder=0 + clv ; V=0 means div result = 0 +PRDECDIV10 cmp #10/2 ; Calculate OSNUM/10 + bcc PRDEC10 + sbc #10/2+$80 ; Remove digit & set V=1 to show div result > 0 + sec ; Shift 1 into div result +PRDEC10 rol 0,x ; Shift /10 result into OSNUM + rol 1,x + rol 2,x + rol 3,x + rol a ; Shift bits of input into acc (input mod 10) + dec OSTEMP + bne PRDECDIV10 ; Continue 32-bit divide + ora #48 + pha ; Push low digit 0-9 to print + iny + bvs PRDECDIGIT ; If V=1, result of /10 was > 0 & do next digit + lda #32 +PRDECLP1 cpy OSPAD + bcs PRDECLP2 ; Enough padding pushed + pha ; Push leading space characters + iny + bne PRDECLP1 +PRDECLP2 pla ; Pop character left to right + jsr OSWRCH ; Print it + dey + bne PRDECLP2 + rts * GSINIT - Initialise for GSTRANS string parsing @@ -247,7 +247,7 @@ GSREADLP STA GSCHAR ; Update accumulator BNE GSREAD2 ; No, check character BIT GSFLAG BPL GSREADEND ; We aren't waiting for a closing quote -* ; End of line before closing quote +* ; End of line before closing quote ERRBADSTR BRK DB $FD ASC 'Bad string' @@ -258,7 +258,7 @@ GSREAD2 CMP #' ' BNE GSREAD3 ; Not a space, process it BIT GSFLAG ; Can space terminate string? BMI GSREADCHAR ; We're waiting for a terminating quote -* ; so return the space character +* ; so return the space character BVC GSREADEND ; Space is a terminator, finish GSREAD3 CMP #$22 ; Is it a quote? BNE GSREADESC ; Not quote, check for escapes @@ -333,10 +333,11 @@ ROMSELECT PHP CPX ROMID ; Speed up by checking if BEQ ROMSELOK ; already paged in -* BUG: This needs ROMID an invalid value on startup so first access works PHA PHX PHY +* LDA $FF +* JSR PR1HEX SEI TXA ; A=ROM to select >>> XF2MAIN,SELECTROM @@ -362,9 +363,6 @@ ROMINIT STZ MAXROM ; One sideways ROM only STA MAXROM :X2 LDA #$FF STA ROMID ; Ensure set to invalid value - RTS - - EVENT RTS @@ -400,15 +398,13 @@ IRQBRKHDLR PHA LDA $0105,X SBC #$00 STA FAULT+1 - - LDA $F4 ; Get current ROM + LDA ROMID ; Get current ROM STA BYTEVARBASE+$BA ; Set ROM at last BRK STX OSXREG ; Pass stack pointer - LDA #$06 ; Service Call 6 = BRK occured - JSR SERVICE + LDX #$06 ; Service Call 6 = BRK occured + JSR SERVICEX LDX BYTEVARBASE+$FC ; Get current language JSR ROMSELECT ; Bring it into memory - PLA TAX PLA @@ -443,8 +439,8 @@ PRERRLP LDA (FAULT),Y JSR OSWRCH INY BNE PRERRLP -NULLRTS -PRERR1 RTS +PRERR1 +NULLRTS RTS * Default page 2 contents @@ -491,7 +487,7 @@ MOSAPI EQU $FF95 * OPTIONAL ENTRIES * ---------------- -OSSERV JMP SERVICE ; FF95 OSSERV +OSSERV JMP SERVICEX ; FF95 OSSERV OSCOLD JMP NULLRTS ; FF98 OSCOLD OSPRSTR JMP OUTSTR ; FF9B OSPRSTR OSSCANDEC JMP SCANDEC ; FF9E SCANDEC diff --git a/auxmem.oscli.s b/auxmem.oscli.s index eb9672c..cbebc12 100644 --- a/auxmem.oscli.s +++ b/auxmem.oscli.s @@ -14,6 +14,7 @@ * Sorted command table, added *HELP FILE. * Optimised CLILOOK dispatcher. * 05-Nov-2022 Added ROM, TAPE, TV to command table -> OSBYTE calls. +* 06-Nov-2022 Rewrote *BUILD, avoids using code memory. * COMMAND TABLE @@ -24,13 +25,17 @@ * b6=0 - Enter with XY=>parameters * b6=1 - Enter with LPTR,Y=>parameters * -* Ok, let's get around to sorting these -CMDTABLE -CMDFILE ASC 'CAT' ; Must be first command so matches '*.' +CMDTABLE ASC 'CAT' ; Must be first command so matches '*.' + DB $85 + DW STARFSC-1 ; CAT -> FSC 5, XY=>params + ASC 'BASIC' ; Bodge to allow *B. priority over *BUILD + DB $FF + DW STARBASIC-1 ; BASIC -> (LPTR)=>params +CMDFILE ASC 'CAT' DB $85 DW STARFSC-1 ; CAT -> FSC 5, XY=>params ASC 'BUILD' - DB $81 ; TO DO + DB $80 ; $81 ; TO DO DW CMDBUILD-1 ; BUILD -> XY=>params ASC 'CDIR' DB $88 @@ -42,10 +47,10 @@ CMDFILE ASC 'CAT' ; Must be first command so matches '*.' DB $86 DW STARFILE-1 ; DELETE -> OSFILE 06, CBLK=>filename ASC 'DUMP' - DB $81 ; TO DO + DB $80 ; $81 ; TO DO DW CMDDUMP-1 ; DUMP -> XY=>params ASC 'EXEC' - DB $81 ; TO DO + DB $80 ; $81 ; TO DO DW CMDEXEC-1 ; EXEC -> XY=>params ASC 'EX' DB $89 @@ -72,10 +77,10 @@ CMDFILE ASC 'CAT' ; Must be first command so matches '*.' DB $81 DW STARSAVE-1 ; SAVE -> OSFILE 00, CBLK=>filename ASC 'SPOOL' - DB $81 ; TO DO + DB $80 ; $81 ; TO DO DW CMDSPOOL-1 ; SPOOL -> XY=>params ASC 'TYPE' - DB $81 ; TO DO + DB $80 ; $81 ; TO DO DW CMDTYPE-1 ; TYPE -> XY=>params * Split between HELP lists DB $00 @@ -93,7 +98,7 @@ CMDMOS ASC 'BASIC' DB $FF DW CMDFAST-1 ; FAST -> (LPTR)=>params ASC 'HELP' - DB $81 + DB $80 DW STARHELP-1 ; HELP -> XY=>params ASC 'KEY' DB $FF @@ -120,13 +125,13 @@ CMDMOS ASC 'BASIC' * *HELP TABLE ************* HLPTABLE ASC 'MOS' - DB $80 + DB $FF DW HELPMOS-1 ; *HELP MOS ASC 'FILE' - DB $80 + DB $FF DW HELPFILE-1 ; *HELP FILE ASC 'HOSTFS' - DB $80 + DB $FF DW HELPHOSTFS-1 ; *HELP HOSTFS DB $FF @@ -193,12 +198,12 @@ CLIMATCH3 JSR SKIPSPC ; (OSLPTR),Y=>parameters PHX ; SP->high PHA ; SP->low, high PHP ; SP->flg, low, high -* BIT OSTEMP -* BVS CLICALL - LDA OSTEMP - ASL A ; Move bit 6 into bit 7 - BMI CLICALL ; If b6=1 don't convert LPTR - BEQ CLICALL ; *TEMP* If $80, skip - remove when HOSTFS updated + BIT OSTEMP ; Test command parameter + BVS CLICALL ; If b6=1 don't convert LPTR +; LDA OSTEMP +; ASL A ; Move bit 6 into bit 7 +; BMI CLICALL ; If b6=1 don't convert LPTR +; BEQ CLICALL ; *TEMP* If $80, skip - remove when HOSTFS updated * JSR LPTRtoXY ; XY=>parameters CLICALL LDA OSTEMP ; A=command parameter @@ -213,6 +218,7 @@ CLISTEP2 LDA (OSTEXT,X) ; Get next byte * OSCLI HANDLER +*************** * On entry, XY=>command string * On exit, AXY corrupted or error generated * @@ -246,8 +252,8 @@ CLISLASH JSR SKIPSPC1 LDA #$02 BNE STARFSC2 ; FSC 2 = */filename * -CLIUNKNOWN LDA #$04 - JSR SERVICE ; Offer to sideways ROM(s) +CLIUNKNOWN LDX #$04 + JSR SERVICEX ; Offer to sideways ROM(s) BEQ CLIDONE ; Claimed LDA #$03 ; FSC 3 = unknown command STARFSC2 PHA @@ -303,9 +309,15 @@ STARBYTE2 LDY OSYREG * Line scanning * ------------- - * Scan decimal number -SCANDEC JSR SKIPSPC +********************* +* On entry, (OSLPTR),Y=>first character +* On exit, A =8-bit decimal value +* X =preserved +* (OSLPTR),Y=>skipped spaces after number +* +SCANDEC +* JSR SKIPSPC JSR SCANDIGIT ; Check first digit BCS ERRBADNUM ; Doesn't start with a digit SCANDECLP STA OSTEMP ; Store as current number @@ -325,7 +337,8 @@ SCANDECLP STA OSTEMP ; Store as current number BCC SCANDECLP BCS ERRBADNUM ; Overflowed -SCANDECOK LDA OSTEMP ; Return A=number +SCANDECOK JSR SKIPSPC ; Ensure trailing spaces skipped + LDA OSTEMP ; Return A=number SCANDIG2 SEC RTS @@ -351,8 +364,15 @@ HEXDIGIT JSR SCANDIGIT HEXDIGIT2 RTS * Scan hex address -* (OSLPTR),Y=>first character -* $200,X = 4-byte accumulator +****************** +* On entry, (OSLPTR),Y=>first character +* $0200,X = 4-byte accumulator +* On exit, $0200,X = 4-byte accumulator +* (OSLPTR),Y=>skipped spaces after number +* X =preserved +* A =next character +* EQ =end of line, no more parameters +* SCANHEX JSR HEXDIGIT ; Get first digit BCS ERRBADADD1 ; Not a hex character STA $200,X ; Store first digit @@ -438,7 +458,7 @@ STARHELP JSR XYtoLPTR ; Update OSLPTR=>parameters JSR PRHELLO ; Unify version message LDX #command table LDY #>HLPTABLE - JSR CLILOOKUP ; Look for *HELP subject + JSR CLILOOKUP ; Look for *HELP subject at OSLPTR BEQ STARHELP9 ; Matched LDA $8006 ; Does ROM have service entry? BMI STARHELP6 ; Yes, skip to send service call @@ -448,8 +468,8 @@ STARHELP JSR XYtoLPTR ; Update OSLPTR=>parameters JSR OSPRSTR JSR OSNEWL STARHELP6 LDY #0 ; (OSLPTR),Y=>parameters - LDA #9 - JMP SERVICE ; Pass to sideways ROM(s) + LDX #9 + JMP SERVICEX ; Pass to sideways ROM(s) * Print *HELP text HELPHOSTFS LDX #' BRK -* Handle *DUMP command -* -------------------- +* *DUMP +* ------------ * XY=>parameters string, EQ=no parameters * CMDDUMP BEQ ERRDUMP ; No filename @@ -696,7 +716,64 @@ CMDDUMP BEQ ERRDUMP ; No filename BCC :LOOP1 JMP TYPCLOSE ; Close and finish -* *SPOOL () +* *BUILD +* ------------ +* XY=>parameters string, EQ=no parameters +* +BUILDLINE EQU $0700 +ERRBUILD BRK + DB $DC + ASC 'Syntax: BUILD ' + BRK +BUILDBUF DW BUILDLINE ; Control block to read a line + DB $80 ; 128 characters max + DB 32 ; Min char + DB 126 ; Max char + +CMDBUILD BEQ ERRBUILD ; No filename + LDA #$80 ; A=OPENOUT, for writing + JSR OPENAFILE ; Try to open file + PHA + LDA #0 ; Line number + PHA + PHA +:BUILDLP1 PLA ; Get line number + PLY + CLC + SED ; Use BCD arithmetic + ADC #$01 ; Add one to line number + BCC :BUILD2 + INY +:BUILD2 CLD + PHY + PHA + TAX + JSR PR2HEX ; Print line number + JSR PRSPACE ; Followed by a space + LDX # control block + LDY #>BUILDBUF + LDA #$00 + JSR OSWORD ; OSWORD &00 input line + BCS :BUILDDONE + TSX + LDY $103,X ; Get handle + LDX #$00 +:BUILDLP2 LDA BUILDLINE,X ; Get char from line + JSR OSBPUT ; Write it to the file + INX + CMP #$0D + BNE :BUILDLP2 ; Loop until terminating CR + BEQ :BUILDLP1 ; Go for another line +:BUILDDONE LDA #$7C + JSR OSBYTE ; Clear Escape state + PLA ; Drop line number + PLA + PLY ; Get handle + LDA #$00 + JSR OSFIND ; Close the file + JMP OSNEWL ; Print newline and exit + +* *SPOOL () * --------------- * XY=>parameters string, EQ=no parameters * @@ -741,91 +818,6 @@ OPENAFILE JSR OSFIND ; Try to open file EXECNOTFND JMP ERRNOTFND ; File not found -* *BUILD () -* --------------- -* XY=>parameters string -* -CMDBUILD LDA #$80 ; A=OPENOUT, for writing - JSR OPENAFILE ; Try to open file - STA :FILENUM ; Stash file number - JSR LNCTRRESET ; Reset line counter -:RDLINE JSR LNCTRINCR ; Increment line counter - JSR LNCTRPRT ; Print line counter - LDA #<:LINEBUF ; Pointer to line buffer - STA OSTEXT+0 - LDA #>:LINEBUF - STA OSTEXT+1 - LDA #80 ; Maximum line length - STA MAXLEN - LDA #32 ; Minimum allowable char - STA MINCHAR - LDA #126 ; Maximum allowable char - STA MAXCHAR - LDA #$00 ; OSWORD &00 input line from console - LDX # control block - LDY #>OSTEXT - JSR OSWORD ; Read line from console - PHP - LDA #$0D ; Carriage return - STA :LINEBUF,Y ; Force carriage return - INY ; Include the carriage return - STY :LINELEN ; Number of chars read - LDX #$00 -:L1 CPX :LINELEN - BEQ :S1 - LDA :LINEBUF,X - LDY :FILENUM ; Recover file number - JSR OSBPUT ; Write char to file - INX - BRA :L1 -:S1 PLP - BCS :CLOSE ; Escape pressed - BRA :RDLINE -:CLOSE JSR OSNEWL - LDA #$00 ; A=CLOSE - LDY :FILENUM ; Recover file number - JSR OSFIND ; Close build file - STZ ESCFLAG - RTS -:LINEBUF DS 81 ; 80 char line plus CR -:LINELEN DB $00 ; Line length excluding CR -:FILENUM DB $00 ; File handle - - - -* Reset line counter -* Helper function used for *BUILD and *LIST line counter -LNCTRRESET STZ LINENUM+0 ; Zero line counter - STZ LINENUM+1 - STZ TEMP32+0 ; Zero buffer used by PRINTDEC - STZ TEMP32+1 - STZ TEMP32+2 - STZ TEMP32+3 - RTS - -* Increment line counter -* Helper function used for *BUILD and *LIST line counter -LNCTRINCR INC LINENUM+0 ; Increment line counter - BNE :DONE - INC LINENUM+1 -:DONE RTS - -* Print line counter -* Helper function used for *BUILD and *LIST line counter -LNCTRPRT LDA LINENUM+0 ; Print line number - STA TEMP32+0 - LDA LINENUM+1 - STA TEMP32+1 - LDX #TEMP32 - LDY #$04 ; Pad to length 4 - JSR PRINTDEC - LDA #' ' ; Print space - JSR OSWRCH - RTS - -LINENUM DW $00 ; Line number - - * ZIP SPEED COMMANDS * ==================