Minor tweak to *BUILD code.

This commit is contained in:
Bobbi Webber-Manners 2022-11-04 00:47:29 -04:00
parent 3f8465983b
commit b6d33e620b
5 changed files with 48 additions and 50 deletions

Binary file not shown.

View File

@ -9,11 +9,15 @@
MAXROM EQU $F9 ; Max sideways ROM number MAXROM EQU $F9 ; Max sideways ROM number
ZP1 EQU $90 ; $90-$9f are spare Econet space *
; so safe to use * $90-$9f are spare Econet space so safe to use
*
ZP1 EQU $90
ZP2 EQU $92 ZP2 EQU $92
ZP3 EQU $94 ZP3 EQU $94
TEMP32 EQU $96 ; $96-$99 inclusive
STRTBCKL EQU $9D ; *TO DO* No longer needed to preserve STRTBCKL EQU $9D ; *TO DO* No longer needed to preserve
STRTBCKH EQU $9E STRTBCKH EQU $9E

View File

@ -139,38 +139,38 @@ PRNIB CMP #$0A
* X=>four byte zero page locations * X=>four byte zero page locations
* Y= number of digits to pad to, 0 for no padding * Y= number of digits to pad to, 0 for no padding
* *
PRINTDEC sty OSPAD ; Number of padding+digits PRINTDEC STY OSPAD ; Number of padding+digits
ldy #0 ; Digit counter LDY #0 ; Digit counter
PRDECDIGIT lda #32 ; 32-bit divide PRDECDIGIT LDA #32 ; 32-bit divide
sta OSTEMP STA OSTEMP
lda #0 ; Remainder=0 LDA #0 ; Remainder=0
clv ; V=0 means div result = 0 CLV ; V=0 means div result = 0
PRDECDIV10 cmp #10/2 ; Calculate OSNUM/10 PRDECDIV10 CMP #10/2 ; Calculate OSNUM/10
bcc PRDEC10 BCC PRDEC10
sbc #10/2+$80 ; Remove digit & set V=1 to show div result > 0 SBC #10/2+$80 ; Remove digit & set V=1 to show div result > 0
sec ; Shift 1 into div result SEC ; Shift 1 into div result
PRDEC10 rol 0,x ; Shift /10 result into OSNUM PRDEC10 ROL 0,X ; Shift /10 result into OSNUM
rol 1,x ROL 1,X
rol 2,x ROL 2,X
rol 3,x ROL 3,X
rol a ; Shift bits of input into acc (input mod 10) ROL A ; Shift bits of input into acc (input mod 10)
dec OSTEMP DEC OSTEMP
bne PRDECDIV10 ; Continue 32-bit divide BNE PRDECDIV10 ; Continue 32-bit divide
ora #48 ORA #48
pha ; Push low digit 0-9 to print PHA ; Push low digit 0-9 to print
iny INY
bvs PRDECDIGIT ; If V=1, result of /10 was > 0 & do next digit BVS PRDECDIGIT ; If V=1, result of /10 was > 0 & do next digit
lda #32 LDA #32
PRDECLP1 cpy OSPAD PRDECLP1 CPY OSPAD
bcs PRDECLP2 ; Enough padding pushed BCS PRDECLP2 ; Enough padding pushed
pha ; Push leading space characters PHA ; Push leading space characters
iny INY
bne PRDECLP1 BNE PRDECLP1
PRDECLP2 pla ; Pop character left to right PRDECLP2 PLA ; Pop character left to right
jsr OSWRCH ; Print it JSR OSWRCH ; Print it
dey DEY
bne PRDECLP2 BNE PRDECLP2
rts RTS
* GSINIT - Initialise for GSTRANS string parsing * GSINIT - Initialise for GSTRANS string parsing

View File

@ -715,8 +715,15 @@ CMDBUILD LDA #$80 ; A=OPENOUT, for writing
STA :LINEBUF+1,Y ; Force carriage return STA :LINEBUF+1,Y ; Force carriage return
INY ; Include the carriage return INY ; Include the carriage return
STY :LINELEN ; Number of chars read STY :LINELEN ; Number of chars read
JSR :BUILDLN ; Write one line to disk LDX #$00
PLP :L1 CPX :LINELEN
BEQ :S1
LDA :LINEBUF+1,X
LDY :FILENUM ; Recover file number
JSR OSBPUT ; Write char to file
INX
BRA :L1
:S1 PLP
BCS :CLOSE ; Escape pressed BCS :CLOSE ; Escape pressed
BRA :RDLINE BRA :RDLINE
:CLOSE JSR OSNEWL :CLOSE JSR OSNEWL
@ -725,19 +732,6 @@ CMDBUILD LDA #$80 ; A=OPENOUT, for writing
JSR OSFIND ; Close build file JSR OSFIND ; Close build file
STZ ESCFLAG STZ ESCFLAG
RTS RTS
* Helper function for CMDBUILD
* Writes a single line from LINEBUF -> disk
:BUILDLN LDX #$00
:L1 CPX :LINELEN
BEQ :DONELN
LDA :LINEBUF+1,X
LDY :FILENUM ; Recover file number
JSR OSBPUT ; Write char to file
INX
BRA :L1
:DONELN RTS
:TEXT ASC 'Build> ' :TEXT ASC 'Build> '
:LINEBUF DS 81 ; 80 char line plus CR :LINEBUF DS 81 ; 80 char line plus CR
:LINELEN DB $00 ; Line length excluding CR :LINELEN DB $00 ; Line length excluding CR

View File

@ -1,2 +1,2 @@
#mame -w apple2ee -debug -sl5 mouse -sl7 cffa2 -harddisk1 ~/Personal/Development/Applecorn/applecorn.po #mame -w apple2ee -debug -sl5 mouse -sl7 cffa2 -harddisk1 ~/Personal/Development/Applecorn/applecorn.po
mame -w apple2gs -debug -sl7 cffa2 -harddisk1 ~/Personal/Development/Applecorn/applecorn.po -harddisk2 tests/JGHMusic1.po mame -w apple2gs -debug -sl7 cffa2 -harddisk1 ~/Personal/Development/Applecorn/applecorn.po -harddisk2 tests/Shawty1.po