Skip to content

Commit

Permalink
Move sdcard stuff around, and add some common utils. v0.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tomm committed Sep 20, 2023
1 parent 86f1cb5 commit 1f8a6d5
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fab-agon-emulator"
version = "0.7.2"
version = "0.7.3"
edition = "2021"
authors = ["Tom Morton <[email protected]>"]
license = "BSD-3-Clause"
Expand Down
21 changes: 21 additions & 0 deletions sdcard/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
bbcbasic.bin - 1.06
Agon BBC BASIC (with negative INKEY() support for MOS 1.04)
https://github.com/breakintoprogram/agon-bbc-basic/

mos/ez80asm.bin - 0.101
EZ80 Assembler for Agon
https://github.com/envenomator/agon-ez80asm

mos/more.bin
Text file viewer
https://github.com/lennart-benschop/agon-utilities/

mos/nano.bin
Text editor
https://github.com/lennart-benschop/agon-utilities/

util/agon-bench.bin
Benchmarking tool
https://github.com/tomm/toms-agon-experiments


File renamed without changes.
73 changes: 73 additions & 0 deletions sdcard/demos/cube.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
10 REM 3D CUBE EXAMPLE
20 REM By Dean Belfield
30 :
40 MODE 1
50 PRINT "3D Cube Demo"
60 PRINT
70 INPUT "SOLID (S) OR WIREFRAME (W)";F$: FILLED%=F$="S"
80 INPUT "MODE (0 TO 2)";M%
110 MODE M%
115 VDU 29,640;512;:OD=128
120 :
130 REM Initialise the data
140 READ CN%
150 DIM X%(CN%),Y%(CN%),Z%(CN%),A%(CN%),B%(CN%)
160 FOR I%=1 TO CN%: READ X%(I%),Y%(I%),Z%(I%):NEXT
170 READ TS%
180 DIM S%(TS%,5)
190 FOR I%=1 TO TS%: READ S%(I%,1),S%(I%,2),S%(I%,3),S%(I%,4),S%(I%,5):NEXT
200 REM Variables
210 THETA=0:PSI=0:PHI=0
220 XD=0:YD=0
230 SD=1024
240 REM Transform
250 FOR I%=1 TO CN%
260 REM Rotate
270 XX=X%(I%):YY=Y%(I%):ZZ=Z%(I%)
280 Y=YY*COS(PHI/180*PI)-ZZ*SIN(PHI/180*PI)
290 ZZ=YY*SIN(PHI/180*PI)+ZZ*COS(PHI/180*PI)
300 X=XX*COS(THETA/180*PI)-ZZ*SIN(THETA/180*PI)
310 ZZ=XX*SIN(THETA/180*PI)+ZZ*COS(THETA/180*PI)
320 XX=X*COS(PSI/180*PI)-Y*SIN(PSI/180*PI)
330 YY=X*SIN(PSI/180*PI)+Y*COS(PSI/180*PI)
340 REM Transform
350 XX=XX+XD:YY=YY+YD
360 REM Perspective
370 A%(I%)=XX*SD/(OD-ZZ)
380 B%(I%)=YY*SD/(OD-ZZ)
390 NEXT
400 REM Draw
410 CLS
415 I%=RND(-55)
420 FOR I%=1 TO TS%
425 GCOL 0,S%(I%,5)
430 C1%=S%(I%,1):C2%=S%(I%,2):C3%=S%(I%,3):C4%=S%(I%,4)
440 X1=A%(C1%):X2=A%(C2%):X3=A%(C3%):X4=A%(C4%)
450 Y1=B%(C1%):Y2=B%(C2%):Y3=B%(C3%):Y4=B%(C4%)
460 IF X1*(Y2-Y3)+X2*(Y3-Y1)+X3*(Y1-Y2) > 0 THEN GOTO 530
480 IF FILLED%=0 THEN GOTO 520
490 MOVE X1,Y1:MOVE X2,Y2:PLOT 85,X3,Y3
500 MOVE X3,Y3:MOVE X4,Y4:PLOT 85,X1,Y1
510 GOTO 530
520 MOVE X1,Y1:PLOT 5,X2,Y2:PLOT 5,X3,Y3:PLOT 5,X4,Y4:PLOT 5,X1,Y1
530 NEXT
540 PHI=PHI+4
550 THETA=THETA-1
560 GOTO 250
570 REM DATA
580 DATA 8
590 DATA -20,20,20
600 DATA 20,20,20
610 DATA -20,-20,20
620 DATA 20,-20,20
630 DATA -20,20,-20
640 DATA 20,20,-20
650 DATA -20,-20,-20
660 DATA 20,-20,-20
670 DATA 6
680 DATA 1,2,4,3,9
690 DATA 7,8,6,5,10
700 DATA 2,6,8,4,11
710 DATA 3,7,5,1,12
720 DATA 3,4,8,7,13
730 DATA 1,5,6,2,14
50 changes: 50 additions & 0 deletions sdcard/demos/mode_test_18.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
10 REM Mode Test
20 :
30 NUMMODES=18
40 :
50 FOR M%=0 TO NUMMODES
60 MODE M%
70 PROC_testCard
80 PRINT TAB(2,2);"Mode: ";M%
90 PROC_displayInfo(2,4)
100 A%=INKEY(2000)
110 NEXT
120 END
130 :
140 DEF FN_getByteVDP(var%)
150 A%=&A0
160 L%=var%
170 =USR(&FFF4)
180 :
190 DEF FN_getWordVDP(var%)
200 =FN_getByteVDP(var%)+256*FN_getByteVDP(var%+1)
210 :
220 DEF PROC_displayInfo(x%,y%)
230 W%=FN_getWordVDP(&0F)
240 H%=FN_getWordVDP(&11)
250 C%=FN_getByteVDP(&13)
260 R%=FN_getByteVDP(&14)
270 D%=FN_getByteVDP(&15)
280 PRINT TAB(x%,y%+0)"W:"W%
290 PRINT TAB(x%,y%+1)"H:"H%
300 PRINT TAB(x%,y%+2)"C:"C%
310 PRINT TAB(x%,y%+3)"R:"R%
320 PRINT TAB(x%,y%+4)"#:"D%
330 ENDPROC
340 :
350 DEF PROC_testCard
360 FOR X%=0 TO 1279 STEP 20
370 GCOL 0,X%/20
380 MOVE X%,0:MOVE X%+20,0:PLOT 80,X%+20,80
390 MOVE X%,0:MOVE X%,80:PLOT 80,X%+20,80
400 NEXT
410 GCOL 0,15
420 MOVE 0,0:DRAW 1279,0: DRAW 1279,1023: DRAW 0,1023: DRAW 0,0
430 MOVE 640,512: PLOT 148,640,1000
440 FOR X%=0 TO 1279 STEP 80
450 MOVE X%,0: DRAW X%,1023
460 NEXT
470 FOR Y%=0 TO 1023 STEP 80
480 MOVE 0,Y%: DRAW 1279,Y%
490 NEXT
500 ENDPROC
Binary file added sdcard/mos/ez80asm.bin
Binary file not shown.
Binary file added sdcard/mos/ez80asm.ldr
Binary file not shown.
Binary file added sdcard/mos/more.bin
Binary file not shown.
Binary file added sdcard/mos/nano.bin
Binary file not shown.
Binary file added sdcard/util/agon-bench.bin
Binary file not shown.

0 comments on commit 1f8a6d5

Please sign in to comment.