"Connect 4" conversion from BASIC to Machine Code

Post Reply
User avatar
mz-80a
Posts: 409
Joined: Thu Jan 25, 2018 10:46 am
Location: Devon, UK
Contact:

"Connect 4" conversion from BASIC to Machine Code

Post by mz-80a »

I recently made it a challenge for myself to convert the game "Connect 4" from the BASIC listing found on Page 24 of "Peeking and Pokeing the MZ-80A" by G. P. Ridley to machine code. It's probably taken me around a week to do with lots of debugging and wondering why certain routines that seemed logical to me weren't behaving as expected (the routine which finds a winning line of 4, for instance, had a few re-writes before I got a working behaviour out of it!). As a bit of an amateur assembly language programmer this feels like a big deal to me :) I didn't realise, at first glance, how complicated some of the BASIC listing was. I thought it would be an easy game to convert to machine code but lots of bits tripped me up. I had to also take an already-written multiplication maths routine from the web (no point in re-inventing the wheel).

I am going to put a code comparison between the BASIC and assembly language versions on my website soon and am also part way through fully writing all this up for an SUC newsletter.

As for now, I have attached the finished game to this post. The ZIP file contains the original BASIC version (as typed in by my friend Joachim - it was because of him that I decided to set myself this challenge and to hopefully show him a few assembly language instructions too), the machine code version and the object code (compatible with the ZEN assembler).

Joachim also has an article on his website here about his experience typing in Connect 4:

https://spillhistorie.no/2018/09/04/spi ... rp-mz-80a/

As far as my assembly code goes : I could have written the code in a much more efficient manner but have decided to leave it so that it more closely matches the BASIC algorithms. Anyway, files are attached here.
CONNECT4.zip
(5.16 KiB) Downloaded 1387 times
MZ-80A Secrets
https://mz-80a.com/

Sharpworks (Sharp MZ homebrew)
https: //mz-sharpworks.co.uk/
User avatar
mz-80a
Posts: 409
Joined: Thu Jan 25, 2018 10:46 am
Location: Devon, UK
Contact:

Re: "Connect 4" conversion from BASIC to Machine Code

Post by mz-80a »

And forgot to put a link to Peeking and Pokeing. The Connect 4 listing is on Page 24 here:

https://mz80a.files.wordpress.com/2015/ ... gmz80a.pdf
MZ-80A Secrets
https://mz-80a.com/

Sharpworks (Sharp MZ homebrew)
https: //mz-sharpworks.co.uk/
User avatar
mz-80a
Posts: 409
Joined: Thu Jan 25, 2018 10:46 am
Location: Devon, UK
Contact:

Re: "Connect 4" conversion from BASIC to Machine Code

Post by mz-80a »

Whoops... in the ZIP file I named something incorrectly.
"CONNECT4-OBJ.MZF" should actually be named "CONNECT4-SRC.MZF" as it is the source code, not the object code.
Also, I am still writing up the notes comparing the BASIC code with the assembly code, still to come in this post.
MZ-80A Secrets
https://mz-80a.com/

Sharpworks (Sharp MZ homebrew)
https: //mz-sharpworks.co.uk/
User avatar
mz-80a
Posts: 409
Joined: Thu Jan 25, 2018 10:46 am
Location: Devon, UK
Contact:

Re: "Connect 4" conversion from BASIC to Machine Code

Post by mz-80a »

I actually started writing this post about a year ago and saved it as a draft. I never actually completed the post / comparison of the BASIC code versus Assembly code. I thought I'd put this up anyway. If I do actually get time to complete this comparison then I will edit the post in the future with the full comparison code.

OK here is the code comparison between the original BASIC listing and my machine code version (which tries to stay as close as it can to the original BASIC algorithms). I'm just doing this for interest's sake. This is section by section of the listing from the book mentioned above. I may put this up on my website sometime too.

Code: Select all

BASIC:
------
10 GOSUB 1130

ASSEMBLY:
---------
CALL TITLES

Jump to the subroutine which displays the title screen of the game.

Code: Select all

BASIC:
------
20 DIM NA$(2),X(9),B(3),FW(4),S(2)
No equivalent for DIM in assembly language. We will simply designate some areas of memory at the end of the program where numeric or string data can be stored.

Code: Select all

BASIC:
------
30 FOR N=1 TO 2
40 X=53858
50 PRINT "[C]WHAT IS YOUR NAME PLAYER";N:USR(62)
60 INPUT NA$(N)
70 N$="HELLO'"+NA$(N)
80 FOR L=1 TO LEN(N$)
90 A=ASC(MID$(N$,L,1))
100 P=X+L-20*(A-64)
110 M=X+L
120 POKE M+80,A+64
130 FOR J=M TO P STEP -40
140 IF J=P THEN POKE J,248:GOTO 160
150 POKE J,127
160 NEXT J,L
170 USR(62):MUSIC "R9"
180 NEXT N
190 N=1
200 PRINT "[C]"

ASSEMBLY:
---------
LD B,2
LD DE,NA+6
PUSH DE

NAMELOOP:
PUSH DE
LD HL,XPOS
LD (HL),62H
INC HL
LD (HL),0D2H
LD DE,NAME
CALL 0015H
LD A,(N)
CALL 03DAH
CALL 0012H
CALL 6
CALL 62
POP DE
CALL 3
PUSH BC
LD BC,6
LD H,D
LD L,E
SBC HL,BC
LD D,H
LD E,L
POP BC
LD C,1
DRAWBAR:
LD A,(DE)
CP 13
JR Z,NEXTNAME
CP 65
JR C,SKIPCHAR
SBC A,64
PUSH DE
LD DE,20
CALL MULTIPLY
LD D,H
LD E,L
LD HL,(XPOS)
SBC HL,DE
PUSH BC
LD B,0
ADD HL,BC
LD D,H
LD E,L
LD HL,(XPOS)
ADD HL,BC
LD BC,80
ADD HL,BC
ADD A,128
LD (HL),A
SBC HL,BC
LD BC,40
BARLOOP:
OR A
SBC HL,DE
ADD HL,DE
JR Z,EQUAL
JR C,NEXTBAR
LD (HL),127
SBC HL,BC
JR BARLOOP
EQUAL:
LD (HL),248
NEXTBAR:
POP BC
POP DE
SKIPCHAR:
INC DE
INC C
JR DRAWBAR
NEXTNAME:
POP DE
CALL 62
PUSH DE
LD DE,MUSICR9
CALL 0030H
POP DE
LD A,(N)
INC A
LD (N),A
PUSH BC
LD BC,86
LD H,D
LD L,E
ADD HL,BC
LD D,H
LD E,L
POP BC
DEC B
LD A,B
CP 0
JP NZ,NAMELOOP

LD A,1
LD (N),A
BEGIN:
LD A,0C6H
CALL 0DDCH
Allow two player names to be entered. Each name is displayed with a nice graph where the height of the bars in the graph is determined by its position in the alphabet. Finish by setting N to 1 and clearing the screen.

Code: Select all

BASIC:
------
210 FOR A=1 TO 9
220 READ X
230 FOR B=1 TO 8
240 POKE X,121
250 X=X+40
260 POKE X,189
270 X=X+40
280 NEXT B
290 NEXT A
300 DATA 53426,53428,53430,53432,53434,53436,53438,53440,53442
310 RESTORE
320 FOR A=1 TO 8
330 READ X
340 FOR B=1 TO 8
350 POKE X+41,120
360 X=X+80
370 NEXT B,A
380 RESTORE
390 AA=33
400 FOR A=1 TO 8
410 READ X
420 POKE X-119,AA
430 AA=AA+1
440 NEXT A

ASSEMBLY:
---------
LD A,9
LD IX,XA
BOARD1:
LD H,(IX+1)
LD L,(IX+0)
LD B,8
BOARD11:
LD (HL),121
PUSH BC
LD BC,40
ADD HL,BC
LD (HL),189
ADD HL,BC
POP BC
DJNZ BOARD11
INC IX
INC IX
DEC A
CP 0
JR NZ,BOARD1

LA A,8
LD IX,XA
BOARD2:
LD H,(IX+1)
LD L,(IX+0)
LD B,8
BOARD22:
PUSH BC
LD BC,41
ADD HL,BC
LD (HL),120
LD BC,39
ADD HL,BC
POP BC
DJNZ BOARD22
INC IX
INC IX
DEC A
CP 0
JR NZ,BOARD2

LD A,33
LD IX,XA
LD B,8
BOARD3:
LD H,(IX+1)
LD L,(IX+0)
PUSH BC
LD BC,119
SBC HL,BC
LD (HL),A
POP BC
INC A
INC IX
INC IX
DJNZ BOARD3
Display the main playing area (the game board) with the column numbers above each column.

Code: Select all

BASIC:
------
450 CURSOR 0,20:PRINT  "-------------------1 2 3 4 5 6 7 8------"
460 PRINT "[H]SCORE"
470 CURSOR 0,1:PRINT S(1)
480 CURSOR 0,3:PRINT S(2)
490 CURSOR 3,1:PRINT NA$(1);" IS [FILLED CIRCLE]"
500 CURSOR 3,3:PRINT NA$(2);" IS [UNFILLED CIRCLE]"
510 CURSOR 0,22:PRINT SPACE$(24)
520 P=N+70

ASSEMBLY:
---------
LD HL,1400H
LD (1171H),HL
LD DE,COLUMNS
CALL 0015H
LD DE,SCORE
CALL 0015H
LD HL,0101H
LD (1171H),HL
LD IX,S
LD A,(IX+0)
CALL 03DAH
CALL 0012H
LD HL,0301H
LD (1171H),HL
LD A,(IX+1)
CALL 03DAH
CALL 0012H
LD HL,0103H
LD (1171H),HL
LD DE,NA+6
CALL 0015H
LD DE,PIECE1
CALL 0015H
LD HL,0303H
LD (1171H),HL
LD DE,NA+92
CALL 0015H
LD DE,PIECE2
CALL 0015H

BEGINCHOICE:
LD HL,1600H
LD (1171H),HL
LD B,24
BLANKSP:
CALL 000CH
DJNZ BLANKSP
LD HL,PP
LD A,(N)
ADD A,70
LD (HL),A
Further display set up. Another set of column numbers is put at the bottom of the main game board (this is used so that falling pieces can tell when they've reached the bottom of an empty column). Display player names, pieces, scores etc. The printing of 24 blank spaces at a particular point of the screen is to erase the message "COLUMN IS FULL" when that particular event occurs.

Code: Select all

BASIC:
------
530 CURSOR 0,11:PRINT "WHICH COLUMN(1to8)"
540 PRINT:PRINT SPACE$(18)
550 PRINT "[UP][RIGHT][RIGHT][RIGHT]";NA$(N):USR(62)
560 GET A$:IF A$="" THEN 560
570 IF (ASC(A$)<49)+(ASC(A$)>56) THEN GOTO 560
580 PRINT "[UP][UP][UP]      COLUMN ";A$;"    "

ASSEMBLY:
---------
LD HL,0B00H
LD (1171H),HL
LD DE,CHOICE
CALL 0015H
CALL 6
CALL 6
LD B,18
BLANKSP2:
CALL 000CH
DJNZ BLANKSP2
CALL 6
LD DE,MOVE
CALL 0015H
LD HL,NA+6
LD A,(N)
CP 2
JR NZ,SKIPP2
LD HL,NA+92
SKIPP2:
LD D,H
LD E,L
CALL 0015H
CALL 6
CALL 62
GETKEY1:
CALL 001BH
CP 0
JR NZ,GETKEY1
GETKEY2:
CALL 001BH
CP 0
JR Z,GETKEY2
CP 49
JR C,GETKEY1
CP 57
JR NC,GETKEY1
LD DE,CHOSEN
CALL 0015H
CALL 0012H
LD B,4
PUSH AF
BLANKSP3:
CALL 000CH
DJNZ BLANKSP3
POP AF
Request from the player which column they would like to place their game piece in. Clear the message except for the bit stating their name once a number between 1 and 8 is chosen. There are two routines for fetching a key, the first one waits until no keys are being pressed then the 2nd one fetches the next key press. Machine code runs so fast that sometimes if we don't first wait for no keys to be pressed the player could accidentally hold a key down for too long and multiple turns in the game will be used up. So we clear the keyboard buffer by waiting for no keys before waiting properly for a key to be pressed.
MZ-80A Secrets
https://mz-80a.com/

Sharpworks (Sharp MZ homebrew)
https: //mz-sharpworks.co.uk/
User avatar
mz-80a
Posts: 409
Joined: Thu Jan 25, 2018 10:46 am
Location: Devon, UK
Contact:

Re: "Connect 4" conversion from BASIC to Machine Code

Post by mz-80a »

I'm just putting this here for my own notes. This is the complete Assembly listing for my conversion of G. P. Ridley's "Connect 4" game:

Code: Select all

LD SP,10F0H

CALL TITLES

LD B,2
LD DE,NA+6
PUSH DE

NAMELOOP:
PUSH DE
LD HL,XPOS
LD (HL),62H
INC HL
LD (HL),0D2H
LD DE,NAME
CALL 0015H
LD A,(N)
CALL 03DAH
CALL 0012H
CALL 6
CALL 62
POP DE
CALL 3
PUSH BC
LD BC,6
LD H,D
LD L,E
SBC HL,BC
LD D,H
LD E,L
POP BC
LD C,1
DRAWBAR:
LD A,(DE)
CP 13
JR Z,NEXTNAME
CP 65
JR C,SKIPCHAR
SBC A,64
PUSH DE
LD DE,20
CALL MULTIPLY
LD D,H
LD E,L
LD HL,(XPOS)
SBC HL,DE
PUSH BC
LD B,0
ADD HL,BC
LD D,H
LD E,L
LD HL,(XPOS)
ADD HL,BC
LD BC,80
ADD HL,BC
ADD A,128
LD (HL),A
SBC HL,BC
LD BC,40
BARLOOP:
OR A
SBC HL,DE
ADD HL,DE
JR Z,EQUAL
JR C,NEXTBAR
LD (HL),127
SBC HL,BC
JR BARLOOP
EQUAL:
LD (HL),248
NEXTBAR:
POP BC
POP DE
SKIPCHAR:
INC DE
INC C
JR DRAWBAR
NEXTNAME:
POP DE
CALL 62
PUSH DE
LD DE,MUSICR9
CALL 0030H
POP DE
LD A,(N)
INC A
LD (N),A
PUSH BC
LD BC,86
LD H,D
LD L,E
ADD HL,BC
LD D,H
LD E,L
POP BC
DEC B
LD A,B
CP 0
JP NZ,NAMELOOP

LD A,1
LD (N),A
BEGIN:
LD A,0C6H
CALL 0DDCH
LD A,9
LD IX,XA
BOARD1:
LD H,(IX+1)
LD L,(IX+0)
LD B,8
BOARD11:
LD (HL),121
PUSH BC
LD BC,40
ADD HL,BC
LD (HL),189
ADD HL,BC
POP BC
DJNZ BOARD11
INC IX
INC IX
DEC A
CP 0
JR NZ,BOARD1

LD A,8
LD IX,XA
BOARD2:
LD H,(IX+1)
LD L,(IX+0)
LD B,8
BOARD22:
PUSH BC
LD BC,41
ADD HL,BC
LD (HL),120
LD BC,39
ADD HL,BC
POP BC
DJNZ BOARD22
INC IX
INC IX
DEC A
CP 0
JR NZ,BOARD2

LD A,33
LD IX,XA
LD B,8
BOARD3:
LD H,(IX+1)
LD L,(IX+0)
PUSH BC
LD BC,119
SBC HL,BC
LD (HL),A
POP BC
INC A
INC IX
INC IX
DJNZ BOARD3

LD HL,1400H
LD (1171H),HL
LD DE,COLUMNS
CALL 0015H
LD DE,SCORE
CALL 0015H
LD HL,0101H
LD (1171H),HL
LD IX,S
LD A,(IX+0)
CALL 03DAH
CALL 0012H
LD HL,0301H
LD (1171H),HL
LD A,(IX+1)
CALL 03DAH
CALL 0012H
LD HL,0103H
LD (1171H),HL
LD DE,NA+6
CALL 0015H
LD DE,PIECE1
CALL 0015H
LD HL,0303H
LD (1171H),HL
LD DE,NA+92
CALL 0015H
LD DE,PIECE2
CALL 0015H
BEGINCHOICE:
LD HL,1600H
LD (1171H),HL
LD B,24
BLANKSP:
CALL 000CH
DJNZ BLANKSP
LD HL,PP
LD A,(N)
ADD A,70
LD (HL),A
LD HL,0B00H
LD (1171H),HL
LD DE,CHOICE
CALL 0015H
CALL 6
CALL 6
LD B,18
BLANKSP2:
CALL 000CH
DJNZ BLANKSP2
CALL 6
LD DE,MOVE
CALL 0015H
LD HL,NA+6
LD A,(N)
CP 2
JR NZ,SKIPP2
LD HL,NA+92
SKIPP2:
LD D,H
LD E,L
CALL 0015H
CALL 6
CALL 62
GETKEY1:
CALL 001BH
CP 0
JR NZ,GETKEY1
GETKEY2:
CALL 001BH
CP 0
JR Z,GETKEY2
CP 49
JR C,GETKEY1
CP 57
JR NC,GETKEY1
LD DE,CHOSEN
CALL 0015H
CALL 0012H
LD B,4
PUSH AF
BLANKSP3:
CALL 000CH
DJNZ BLANKSP3
POP AF
OR A
LD B,49
SBC A,B
ADD A,A
LD DE,XA
LD H,0
LD L,A
ADD HL,DE
LD C,(HL)
INC HL
LD B,(HL)
LD H,B
LD L,C
INC HL
LD A,(HL)
CP 0
JR Z,EMPTY
LD HL,1600H
LD (1171H),HL
LD DE,FULL
CALL 0015H
CALL 62
LD DE,MUSICR2
CALL 0030H
JP BEGINCHOICE
EMPTY:
LD BC,80
SBC HL,BC
PLOT:
LD A,(PP)
LD (HL),A
PUSH BC
LD BC,0FA0H
PAUSE:
NOP
DEC BC
LD A,B
OR C
JR NZ,PAUSE
POP BC
ADD HL,BC
LD A,(HL)
CP 0
JR NZ,CHECKWIN
SBC HL,BC
LD (HL),0
ADD HL,BC
JR PLOT
CHECKWIN:
SBC HL,BC
LD (XPOS),HL
LD IX,BA-1
LINELOOP:
LD HL,(XPOS)
LD E,1
LD IY,FW
LD (IY+0),L
LD (IY+1),H
INC IY
INC IY
PUSH IX
LD D,3
LINELOOP2:
INC IX
LD HL,(XPOS)
LD A,(IX+0)
CP 255
JR Z,EXITCHECK
LD B,0
LD C,A
ADD HL,BC
LD A,(PP)
CP (HL)
JR NZ,SUBCHECK
INC E
LD (IY+0),L
LD (IY+1),H
INC IY
INC IY
LD A,E
CP 4
JR Z,FOUNDWIN
DEC D
LD A,D
CP 0
JR NZ,LINELOOP2
SUBCHECK:
POP IX
LD D,3
LINELOOP3:
INC IX
LD HL,(XPOS)
LD A,(IX+0)
CP 255
JR Z,EXITCHECK
LD B,0
LD C,A
OR A
SBC HL,BC
LD A,(PP)
CP (HL)
JR NZ,LINELOOP
INC E
LD (IY+0),L
LD (IY+1),H
INC IY
INC IY
LD A,E
CP 4
JR Z,FOUNDWIN
DEC D
LD A,D
CP 0
JR NZ,LINELOOP3
JR LINELOOP

EXITCHECK:
LD A,(N)
CP 1
JR NZ,SWAPPLAYER
LD A,2
LD (N),A
JP BEGINCHOICE
SWAPPLAYER:
LD A,1
LD (N),A
JP BEGINCHOICE

FOUNDWIN:
LD HL,0F00H
LD (1171H),HL
LD DE,WINNER
CALL 0015H
LD HL,1104H
LD (1171H),HL
LD DE,NA+6
LD A,(N)
CP 2
JR NZ,SHOWNAME
LD DE,NA+92
SHOWNAME:
CALL 0015H
LD HL,S
LD A,(N)
CP 1
JR Z,POINTS
INC HL
POINTS:
LD A,(HL)
INC A
LD (HL),A
LD A,74
LD B,10
FLASHLOOP:
PUSH BC
LD B,4
LD IX,FW
FLASHLOOP2:
LD H,(IX+1)
LD L,(IX+0)
LD (HL),A
INC IX
INC IX
DJNZ FLASHLOOP2
POP BC
PUSH AF
CALL 0062
LD DE,MUSICR1
CALL 0030H
POP AF
CP 74
JR NZ,CHANGECHAR
LD A,(PP)
JR NEXTFLASH
CHANGECHAR:
LD A,74
NEXTFLASH:
DJNZ FLASHLOOP
LD HL,1700H
LD (1171H),HL
LD DE,NEWGAME
CALL 0015H
CALL 6
YESNO:
CALL 001BH
CP 0
JR Z,YESNO
CP 89
JR Z,STARTNEW
CP 78
JR Z,FINISH
JR YESNO
STARTNEW:
LD A,(N)
CP 1
JR Z,CHANGEPLAYER
LD A,1
LD (N),A
JP BEGIN
CHANGEPLAYER:
LD A,2
LD (N),A
JP BEGIN

FINISH:
LD DE,THANKS
CALL 0015H
LD DE,NA+6
CALL 0015H
CALL 000CH
LD A,38
CALL 0012H
CALL 000CH
LD DE,NA+92
CALL 0015H
LD DE,MUSICEND
CALL 0030H
JP 0

TITLES:
LD A,0C6H
CALL 0DDCH
LD B,5

FLASHTITLE:
LD HL,57346
LD (HL),0
LD HL,040AH
LD (1171H),HL
LD DE,TITLE
CALL 0015H
LD HL,060AH
LD (1171H),HL
LD DE,TITLE2
CALL 0015H
LD HL,080AH
LD (1171H),HL
LD DE,TITLE
CALL 0015H
LD DE,MUSICR2
CALL 0030H
LD HL,57346
LD (HL),1
LD DE,MUSICTITLE
CALL 0030H
DJNZ FLASHTITLE

CALL 6
LD DE,INST1
CALL 0015H
CALL 6
LDE DE,INST2
CALL 0015H
CALL 6
LD DE,INST3
CALL 0015H
CALL 6
LD DE,INST4
CALL 0015H
CALL 6
CALL 6
LD DE,SPW
CALL 0015H
CALL 6
LD DE,SPW2
CALL 0015H
CALL 6
LD DE,MUSICR9
CALL 0030H
LD DE,INST5
CALL 0015H

SPACEBAR:
CALL 001BH
CP 32
JR NZ,SPACEBAR
RET

MULTIPLY:
PUSH BC
LD B,8
LD HL,0
ADD HL,HL
RLCA
JR NC,$+3
ADD HL,DE
DJNZ $-5
POP BC
RET

NAME:
DB 22,"WHAT IS YOUR NAME PLAYER "
DB 13

MUSICR9:
DB "R9",13

COLUMNS:
DB "___________________1 2 3 4 5 "
DB "6 7 8______",13

SCORE:
DB 21,"SCORE",13

PIECE1:
DB " IS [FILLED CIRCLE]",13

PIECE2:
DB " IS [UNFILLED CIRCLE]",13

CHOICE:
DB "WHICH COLUMN(1to8)",13

MOVE:
DB "[UP][RIGHT][RIGHT][RIGHT]",13

CHOSEN:
DB "[UP][UP][UP]      COLUMN ",13

FULL:
DB "### COLUMN IS FULL ###",13

MUSICR2:
DB "R2",13

WINNER:
DB "THE WINNER IS",13

MUSICR1:
DB "R1",13

NEWGAME:
DB "ANOTHER GAME? (Y/N)",13

THANKS:
DB "THANKS ",13

MUSICEND:
DB "C3D3F#3",13

TITLE:
DB "*****************",13

TITLE2:
DB "C O N N E C T   4",13

MUSICTITLE:
DB "+C+D",13

INST1:
DB "[DOWN][DOWN][DOWN]FOR 2 PLAYERS",13

INST2:
DB "[DOWN]"THE FIRST TO GET 4 TOKENS "
DB "IN ANY ROW",13

INST3:
DB "[DOWN]IS THE WINNER",13

INST4:
DB "[DOWN]EITHER HORIZONTAL, VERTICAL"
DB " OR DIAGONAL",13

INST5:
DB "[DOWN]press SPACE BAR to play",13

SPW:
DB "CONVERTED TO MACHINE CODE BY"
DB 0DH
DPW2:
DB "B. COFFER / SHARPWORKS (2018)"
DB 0DH

NA:
DB "HELLO'"
DS 80
DB "HELLO'"
DS 80

XA:
DW 53426
DW 53428
DW 53430
DW 53432
DW 53434
DW 53436
DW 53438
DW 53440
DW 53442

BA:
DB 80,160,240,254
DB 78,156,234,254
DB 82,164,246,254
DB 2,4,6,254
DB 255

DW:
DS 16

S:
DB 0,0

N:
DB 1

PP:
DB 71

XPOS:
DW 53858
Obviously I know the code could be more compact but I was trying to stay as true to the original flow of the BASIC listing as I could.
MZ-80A Secrets
https://mz-80a.com/

Sharpworks (Sharp MZ homebrew)
https: //mz-sharpworks.co.uk/
Post Reply