Pong Game Corrected

103 views
Skip to first unread message

Ardunaut

unread,
Aug 30, 2021, 2:04:30 PM8/30/21
to uKenbak-1
After the right shift instruction correction the PONG game is not working correctly.
I change  the instruction at 021 to recover the normal behavior:
   "RT SFT A,1" by "RT ROT A,1"

>di 4 15
Disassembling...
004:023 001  LOAD A C=001
006:311      LFT ROT A,1
007:034 200  STORE A 200
011:124 000  LOAD B 000
013:114 377  SUB B 377
015:234 377  STORE X 377
017:143 006  JPD B!=0 006
021:111      RT ROT A,1  ; Was "RT SFT A,1"
022:034 200  STORE A 200
024:124 000  LOAD B 000
026:113 001  SUB B C=001
030:143 021  JPD B!=0 021
032:344 006  JPD UNC 006

Before the change:

000,000,000,004,023,001,311,034,200,124,000,114,377,234,377,143,
006,011,034,200,124,000,113,001,143,021,344,006,e

After the change:

000,000,000,004,023,001,311,034,200,124,000,114,377,234,377,143,
006,111,034,200,124,000,113,001,143,021,344,006,e

Ardunaut

unread,
Sep 1, 2021, 12:27:22 PM9/1/21
to uKenbak-1
Another iteration...
Pong_kenbakuino_02.txt   Ardunaut AUG 31,2021 (Tested!)
  Code reduction by using the "SKIP 1" instruction.
  ToDo:
  -Create a DISP subroutine with an included delay to run  the program in any KENBAK-1

Based in Pong_kenbakuino.txt   Ardunaut  AUG 31,2021
---------------------------------------------------------------------------

>AS
; Pong Game for kenbakuino Ardunaut AUG 31,2021
; Using the "SKIP 1" instruction to save 2 Bytes.
; To play: Use the system CPU-Delay, (BIT5 + STOP) or (BIT4 + STOP)
ORG     002
DB      000       ; X = 000 (used to clear input)
DB      004       ; Program Counter = 004
LOAD    A C=200   ; ball at start position to serve
LFT ROT A,1       ; move the ball to the left
STORE   A 200     ; shows A in the display
LOAD    B 000     ; A -> B
SUB     B 377     ; (OUTPUT-INPUT) -> B
STORE   X 377     ; clears INPUT
JPD     B!=0 006  ; if (INPUT-OUTPUT) != 0 ball continues, else bounces back
RT ROT  A,1       ; move the ball to the right
STORE   A 200     ; shows A in the display (OUTPUT)
SKIP 1  b0 000    ; ball at start?
JPD     UNC 021   ; continues bouncing back
JPD     UNC 006   ; if ball is at start go to serve
Q

>O 31
Octal file:
000,000,000,004,023,200,311,034,200,124,000,114,377,234,377,143,
006,111,034,200,302,000,343,021,343,006,e

>DI 4 14
Disassembling...
004:023 200  LOAD A C=200
006:311      LFT ROT A,1
007:034 200  STORE A 200
011:124 000  LOAD B 000
013:114 377  SUB B 377
015:234 377  STORE X 377
017:143 006  JPD B!=0 006
021:111      RT ROT A,1
022:034 200  STORE A 200
024:302 000  SKIP 1 b0 000
026:343 021  JPD UNC 021
030:343 006  JPD UNC 006
>

Reply all
Reply to author
Forward
0 new messages