Quote:
What AppleWin version works correct with original A2 ?
I have used 1.17.2.0 and 1.20.0.0 with some success.
Quote:
Working on SW16 and I had a question: SW16 uses R12 for store return adresses for RS/BS, seems ($18)=$FFFF. From other side writing data at adresses fails.
How to initialize data?
Here's a complete example, in which I use sbasm and init register $C with a
SET STK,$0110 directly after I
JSR SWEET16 in
MAIN:
Code:
;234567890123456789012345678901234567890123456789012345
.CR 6502
.TF SWEET16B.OTX,AP1
.LF SWEET16B
;-----------------------------------------------------;
; BEER SONG FOR THE SWEET16 PSEUDO-PROCESSOR ;
; BY BARRYM 2011-05-21 ;
;-----------------------------------------------------;
; THE SWEET16 PSUEDO-PROCESSOR WAS CREATED BY STEVE ;
; WOZNIAK IN 1977 TO HELP HIM WRITE COMPACT (BUT ;
; SLOWER 16-BIT CODE ON HIS NEW BABY, THE APPLE ;
; II. HE NEVER BUILT IT IN HARDWARE, BUT INSTEAD ;
; CREATED A NIFTY LITTLE 372-BYTE INTERPRETER AND ;
; BURNED IT INTO THE ROM OF THE ORIGINAL INTEGER ;
; BASIC APPLE II. ;
; SWEET16 CODE AND 6502 CODE CAN CO-EXIST PEACEFULLY ;
; IN AN APPLE II MACHINE LANGUAGE PROGRAM; A 6502 ;
; 'JSR $F689' IMMEDIATELY PRECEDES A BLOCK OF IN- ;
; LINE SWEET16 INSTRUCTIONS AND A SWEET16 'RTN' ;
; SWITCHES BACK TO 6502 MODE, WHICH MUST BE DONE ;
; AT OR BEFORE PROGRAM COMPLETION. THE ORIGINAL ;
; APPLE II HAD AN UPPER-CASE 40-COLUMN DISPLAY AS ;
; STANDARD EQUIPMENT, SO THE OFFICIAL SONG LYRICS ;
; ARE ADJUSTED ACCORDINGLY. ;
; THANKS TO SBPROJECTS.COM FOR LOTS OF VALUABLE INFO ;
; AND A VERY NICE ASSEMBLER!! ;
; NOTE: 'ADD' AND 'SUB' ARE BUILT-IN 6502 MACROS IN ;
; THE CURRENT VERSION OF THIS ASSEMBLER AND WILL ;
; NOT ASSEMBLE TO THE CORRECT SWEET16 OPCODES (USE ;
; '.DA #$AX' FOR 'ADD X' & '.DA #$BX' FOR 'SUB X') ;
;-----------------------------------------------------;
; CONSTANT EQUATES ;
;-----------------------------------------------------;
SWEET16 = $F689 ROM: WOZ' INTERPRETER
BIN2ASC = $E51B ROM: PRINT UNSIGNED16
PUTCHAR = $FDED ROM: PRINT CHARACTER
MAXB = 99 MUST BE IN [1..65535]
;-----------------------------------------------------;
; REGISTER EQUATES ;
;-----------------------------------------------------;
ACC = $0 SWEET16 MAIN ACCUM.
BEER = $1 BEER COUNTER
TYPE = $2 SUBPHRASE TYPE
PTR = $3 TEXT POINTER
STK = $C SWEET16 STACK POINTER
;-----------------------------------------------------;
; MAIN PROGRAM ;
;-----------------------------------------------------;
.OR $0E00
MAIN JSR SWEET16 ENTER SWEET16 MODE
SET STK,$0110 INIT STACK POINTER
SET BEER,MAXB BEER = MAXB
.DA #$B0 (SUB ACC) TYPE = 0
BS PRSONG PRINT ENTIRE SONG
RTN BACK TO 6502 MODE
RTS EXIT
;-----------------------------------------------------;
; MAIN LOOP: PRINT ALL EXCEPT THE LAST SENTENCE ;
;-----------------------------------------------------;
BEERME SET PTR,TAKE PRINT "TAKE ONE ... AROUND,"
BS PRBOB PRINT " ... ON THE WALL."
PRSONG SET PTR,CR PRINT BLANK LINE
BS PRBOB PRINT " ... ON THE WALL";
DCR ACC TYPE = -1
SET PTR,COMCR PRINT ","
BS PRBOB PRINT " ... OF BEER."
INR ACC TYPE = +1
DCR BEER BEER = BEER - 1
BNM1 BEERME IF BEER <> -1 THEN BEERME
;-----------------------------------------------------;
; SET UP LAST SENTENCE AND FALL THRU ;
;-----------------------------------------------------;
SET BEER,MAXB BEER = MAXB
; PRINT "GO TO ... SOME MORE,"
;-----------------------------------------------------;
; SUBROUTINES FOLLOW ;
;-----------------------------------------------------;
; PRINT A PROPERLY PUNCTUATED BOTTLE SUB-PHRASE ;
; (ENTRY): PTR CONTAINS PRE-STRING POINTER, ACC ;
; CONTAINS SUB-PHRASE TYPE (0 = " ... THE WALL", ;
; -1 = " ... OF BEER.", +1 = " ... THE WALL.") ;
; (EXIT): ACC IS CLEARED ;
;-----------------------------------------------------;
PRBOB ST TYPE
BS PUTS PRINT PRE-STRING
LD BEER IF BEER = 0 THEN
BZ PRBOTT PRINT "NO MORE";
RTN IF BEER > 0 THEN
LDA $03 ESC TO 6502 MODE JUST LONG
LDX $02 ENOUGH TO PRINT VALUE OF
JSR BIN2ASC BEER TO ACTIVE OUTPUT.
JSR SWEET16+3
SET PTR,BOTTL
PRBOTT BS PUTS PRINT " ... BOTTLE";
DCR BEER
BNZ NEQ1 IF BEER = 1 THEN
INR PTR SKIP OVER THE "S"
NEQ1 INR BEER
BS PUTS PRINT " ... OF BEER";
LD TYPE
BM1 NOWALL IF TYPE >= 0 THEN
BS PUTS PRINT " ON THE WALL";
LD TYPE
BZ KPUT IF TYPE <> 0 THEN
NOWALL SET PTR,DOTCR PRINT "."
;-----------------------------------------------------;
; PRINT A NULL-TERMINATED STRING @ PTR ;
; (ENTRY): PTR POINTS TO THE START OF THE STRING ;
; (EXIT): PTR POINTS TO THE NEXT STRING IN MEMORY, ;
; ACC IS CLEARED ;
;-----------------------------------------------------;
PUTS LD @PTR GRAB CHAR @ PTR, ADVANCE PTR
BZ KPUT
RTN ESC TO 6502 MODE
LDA $00 JUST LONG ENOUGH
JSR PUTCHAR TO PRINT THE CHAR
JSR SWEET16+3 TO ACTIVE OUTPUT
BR PUTS LOOP UNTIL NULL
KPUT RS RETURN
;-----------------------------------------------------;
; OPTIMIZED SONG LYRIC STRING ;
;-----------------------------------------------------;
TAKE .AS -"TAKE ONE DOWN AND PASS IT AROUND"
COMCR .AS -","
CR .AZ -#13
.AS -"NO MORE"
BOTTL .AZ -" BOTTLE"
.AZ -"S OF BEER"
.AZ -" ON THE WALL"
DOTCR .AZ -".",#13
.AZ -"GO TO THE STORE AND BUY SOME MORE,",#13
.EN
;-----------------------------------------------------;
; HEX DUMP FOLLOWS. IF YOU COPY AND PASTE THIS INTO ;
; AN APPLE II EMULATOR SUCH AS APPLEWIN 1.17.2.0, ;
; (MY PERSONAL FAVORITE), PLEASE MAKE SURE THAT IT ;
; IS SET TO ORIGINAL APPLE II MODE (INTEGER BASIC ;
; MUST BE AVAILABLE IN ROM OR ON A LANGUAGE CARD ;
; IN ORDER FOR THIS PROGRAM TO WORK). ENJOY! :-) ;
;-----------------------------------------------------;
CALL-151
0E00: 20 89 F6 1C 00 01 11 63 00 B0 0C 07 00 60 13 5C
0E10: 0E 0C 12 13 7D 0E 0C 0D F0 13 7C 0E 0C 07 E0 F1
0E20: 09 EC 11 63 00 32 0C 25 21 06 0E 00 A5 03 A6 02
0E30: 20 1B E5 20 8C F6 13 86 0E 0C 12 F1 07 01 E3 E1
0E40: 0C 0B 22 08 05 0C 06 22 06 11 13 A5 0E 43 06 0B
0E50: 00 A5 00 20 ED FD 20 8C F6 01 F2 0B D4 C1 CB C5
0E60: A0 CF CE C5 A0 C4 CF D7 CE A0 C1 CE C4 A0 D0 C1
0E70: D3 D3 A0 C9 D4 A0 C1 D2 CF D5 CE C4 AC 8D 00 CE
0E80: CF A0 CD CF D2 C5 A0 C2 CF D4 D4 CC C5 00 D3 A0
0E90: CF C6 A0 C2 C5 C5 D2 00 A0 CF CE A0 D4 C8 C5 A0
0EA0: D7 C1 CC CC 00 AE 8D 00 C7 CF A0 D4 CF A0 D4 C8
0EB0: C5 A0 D3 D4 CF D2 C5 A0 C1 CE C4 A0 C2 D5 D9 A0
0EC0: D3 CF CD C5 A0 CD CF D2 C5 AC 8D 00
E00GE000G
_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some
VTL02C on it and see how it grows on you!
Mike B.
(about me) (learning how to github)